toppage_handler.erl 428 B

1234567891011121314151617181920
  1. %% Feel free to use, reuse and abuse the code in this file.
  2. %% @doc Hello world handler.
  3. -module(toppage_handler).
  4. -export([init/3]).
  5. -export([handle/2]).
  6. -export([terminate/3]).
  7. init(_Transport, Req, []) ->
  8. {ok, Req, undefined}.
  9. handle(Req, State) ->
  10. {ok, Req2} = cowboy_req:reply(200, [
  11. {<<"content-type">>, <<"text/plain">>}
  12. ], <<"Hello world!">>, Req),
  13. {ok, Req2, State}.
  14. terminate(_Reason, _Req, _State) ->
  15. ok.