From b8a25b156cb0eb9a99ba4d204cf973e197d7b563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 13 Jul 2012 10:15:22 +0200 Subject: Add an Hello World example --- examples/hello_world/src/toppage_handler.erl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 examples/hello_world/src/toppage_handler.erl (limited to 'examples/hello_world/src/toppage_handler.erl') diff --git a/examples/hello_world/src/toppage_handler.erl b/examples/hello_world/src/toppage_handler.erl new file mode 100644 index 0000000..ba9159d --- /dev/null +++ b/examples/hello_world/src/toppage_handler.erl @@ -0,0 +1,18 @@ +%% Feel free to use, reuse and abuse the code in this file. + +%% @doc Hello world handler. +-module(toppage_handler). + +-export([init/3]). +-export([handle/2]). +-export([terminate/2]). + +init(_Transport, Req, []) -> + {ok, Req, undefined}. + +handle(Req, State) -> + {ok, Req2} = cowboy_http_req:reply(200, [], <<"Hello world!">>, Req), + {ok, Req2, State}. + +terminate(_Req, _State) -> + ok. -- cgit v1.2.3