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