0
새로운 프로젝트 즉, erlang-cowboy 로그인 페이지를 사용하여 로그인 페이지를 만드는 방법을 알려주세요. 사용자가 데이터를 입력하고 버튼을 클릭하면 사용자 이름, 비밀번호 및 제출 버튼이 포함됩니다. 사용자의 세부 사항 그것을 위해 서버에 저장해야 브라우저에서 제출 버튼을 내가 파일 toppage_handler.erl을 생성하지만, 스피 make 명령 오류를 입력 할 때게시물을 사용하고 erlang-cowboy에서 핸들러를 얻는 방법
오류가 제기됩니다
[email protected]:~/cowboy/examples/practice_world# make
make[1]: Entering directory `/root/cowboy/examples/practice_world/deps/cowboy'
make[2]: Entering directory `/root/cowboy/examples/practice_world/deps/cowlib'
APP cowlib.app.src
make[2]: Leaving directory `/root/cowboy/examples/practice_world/deps/cowlib'
make[2]: Entering directory `/root/cowboy/examples/practice_world/deps/ranch'
APP ranch.app.src
make[2]: Leaving directory `/root/cowboy/examples/practice_world/deps/ranch'
APP cowboy.app.src
make[1]: Leaving directory `/root/cowboy/examples/practice_world/deps/cowboy'
ERLC practice_world_app.erl practice_world_sup.erl toppage_handler.erl
src/toppage_handler.erl:14: syntax error before: '{'
src/toppage_handler.erl:4: function handle/2 undefined
make: *** [ebin/practice_world.app] Error 1
과 toppage_handler을. 파일 :
-module(toppage_handler).
-export([init/3]).
-export([handle/2]).
-export([terminate/3]).
init(_Transport, Req, []) ->
{ok, Req, undefined}.
handle(Req, State) ->
{Method, Req2} = cowboy_req:method(Req),
case Method of
<<"POST">> ->
Body = <<"<h1>This is a response for POST</h1>">>
{ok, Req3} = cowboy_req:reply(200, [], Body, Req3),
{ok, Req3, State};
<<"GET">> ->
Body = <<"<h1>This is a response for GET</h1>">>
{ok, Req3} = cowboy_req:reply(200, [], Body, Req3),
{ok, Req3, State};
_ ->
Body = <<"<h1>This is a response for other methods</h1>">>
{ok, Req3} = cowboy_req:reply(200, [], Body, Req3),
{ok, Req3, State}
end.
terminate(_Reason, _Req, _State) ->
ok.
때 스피 배치 ','도 오류가 – user3382006
login.html 파일 제기됩니다
비밀번호 :
– user3382006
쉼표를 추가 한 후에 다른 오류가 발생한다고 생각합니까? 그렇지 않은 경우 세 가지 조항 모두에서 문제가 해결되었는지 확인하십시오. <<"GET">> 및 _ 모두 동일한 문제가있었습니다. –