github.com/SupersunnySea/draft@v0.16.0/examples/example-erlang/src/draft_example_handler.erl (about)

     1  -module(draft_example_handler).
     2  -export([handle/2, handle_event/3]).
     3  
     4  -behaviour(elli_handler).
     5  
     6  handle(Req, _Args) ->
     7      handle(elli_request:method(Req), elli_request:path(Req), Req).
     8  
     9  handle('GET',[], _Req) ->
    10      {200, [], <<"Hello World!">>};
    11  handle(_, _, _Req) ->
    12      {404, [], <<"Not Found">>}.
    13  
    14  handle_event(_Event, _Data, _Args) ->
    15      ok.