aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-04-30 14:41:10 +0200
committerLoïc Hoguin <[email protected]>2016-04-30 14:41:10 +0200
commitff936ff0ee62731d54ec35335355f76577044443 (patch)
tree806e766c619333378c960bf54128d907a6b4094e
parent45158c1da454b5c7406418afeccaecf54232deeb (diff)
downloadcowboy-ff936ff0ee62731d54ec35335355f76577044443.tar.gz
cowboy-ff936ff0ee62731d54ec35335355f76577044443.tar.bz2
cowboy-ff936ff0ee62731d54ec35335355f76577044443.zip
Fix hello_world example
-rw-r--r--examples/hello_world/src/hello_world_app.erl6
-rw-r--r--examples/hello_world/src/toppage_handler.erl8
2 files changed, 7 insertions, 7 deletions
diff --git a/examples/hello_world/src/hello_world_app.erl b/examples/hello_world/src/hello_world_app.erl
index eb938d3..0e4438b 100644
--- a/examples/hello_world/src/hello_world_app.erl
+++ b/examples/hello_world/src/hello_world_app.erl
@@ -16,9 +16,9 @@ start(_Type, _Args) ->
{"/", toppage_handler, []}
]}
]),
- {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
- {env, [{dispatch, Dispatch}]}
- ]),
+ {ok, _} = cowboy:start_clear(http, 100, [{port, 8080}], #{
+ env => #{dispatch => Dispatch}
+ }),
hello_world_sup:start_link().
stop(_State) ->
diff --git a/examples/hello_world/src/toppage_handler.erl b/examples/hello_world/src/toppage_handler.erl
index e8e672e..eb95bf3 100644
--- a/examples/hello_world/src/toppage_handler.erl
+++ b/examples/hello_world/src/toppage_handler.erl
@@ -6,7 +6,7 @@
-export([init/2]).
init(Req, Opts) ->
- Req2 = cowboy_req:reply(200, [
- {<<"content-type">>, <<"text/plain">>}
- ], <<"Hello world!">>, Req),
- {ok, Req2, Opts}.
+ cowboy_req:reply(200, #{
+ <<"content-type">> => <<"text/plain">>
+ }, <<"Hello world!">>, Req),
+ {ok, Req, Opts}.