diff --git a/examples/chunked_hello_world/src/chunked_hello_world_app.erl b/examples/chunked_hello_world/src/chunked_hello_world_app.erl index bdb073f1..0032d01c 100644 --- a/examples/chunked_hello_world/src/chunked_hello_world_app.erl +++ b/examples/chunked_hello_world/src/chunked_hello_world_app.erl @@ -11,11 +11,11 @@ %% API. start(_Type, _Args) -> - Dispatch = [ + Dispatch = cowboy_router:compile([ {'_', [ - {[], toppage_handler, []} + {"/", toppage_handler, []} ]} - ], + ]), {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [ {env, [{dispatch, Dispatch}]} ]), diff --git a/examples/compress_response/src/compress_response_app.erl b/examples/compress_response/src/compress_response_app.erl index b5f3054d..b36dcbd5 100644 --- a/examples/compress_response/src/compress_response_app.erl +++ b/examples/compress_response/src/compress_response_app.erl @@ -11,11 +11,11 @@ %% API. start(_Type, _Args) -> - Dispatch = [ + Dispatch = cowboy_router:compile([ {'_', [ - {[], toppage_handler, []} + {"/", toppage_handler, []} ]} - ], + ]), {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [ {compress, true}, {env, [{dispatch, Dispatch}]} diff --git a/examples/cookie/src/cookie_app.erl b/examples/cookie/src/cookie_app.erl index e527fb1f..91d1b958 100644 --- a/examples/cookie/src/cookie_app.erl +++ b/examples/cookie/src/cookie_app.erl @@ -11,11 +11,11 @@ %% API. start(_Type, _Args) -> - Dispatch = [ + Dispatch = cowboy_router:compile([ {'_', [ {'_', toppage_handler, []} ]} - ], + ]), {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [ {env, [{dispatch, Dispatch}]} ]), diff --git a/examples/echo_get/src/echo_get_app.erl b/examples/echo_get/src/echo_get_app.erl index b8def142..d661e9c8 100644 --- a/examples/echo_get/src/echo_get_app.erl +++ b/examples/echo_get/src/echo_get_app.erl @@ -11,11 +11,11 @@ %% API. start(_Type, _Args) -> - Dispatch = [ + Dispatch = cowboy_router:compile([ {'_', [ - {[], toppage_handler, []} + {"/", toppage_handler, []} ]} - ], + ]), {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [ {env, [{dispatch, Dispatch}]} ]), diff --git a/examples/echo_post/src/echo_post_app.erl b/examples/echo_post/src/echo_post_app.erl index 83b4b3f8..7d86c535 100644 --- a/examples/echo_post/src/echo_post_app.erl +++ b/examples/echo_post/src/echo_post_app.erl @@ -11,11 +11,11 @@ %% API. start(_Type, _Args) -> - Dispatch = [ + Dispatch = cowboy_router:compile([ {'_', [ - {[], toppage_handler, []} + {"/", toppage_handler, []} ]} - ], + ]), {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [ {env, [{dispatch, Dispatch}]} ]), diff --git a/examples/hello_world/src/hello_world_app.erl b/examples/hello_world/src/hello_world_app.erl index ac863270..eb938d30 100644 --- a/examples/hello_world/src/hello_world_app.erl +++ b/examples/hello_world/src/hello_world_app.erl @@ -11,11 +11,11 @@ %% API. start(_Type, _Args) -> - Dispatch = [ + Dispatch = cowboy_router:compile([ {'_', [ - {[], toppage_handler, []} + {"/", toppage_handler, []} ]} - ], + ]), {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [ {env, [{dispatch, Dispatch}]} ]), diff --git a/examples/rest_hello_world/src/rest_hello_world_app.erl b/examples/rest_hello_world/src/rest_hello_world_app.erl index c7f608ca..a662c3d2 100644 --- a/examples/rest_hello_world/src/rest_hello_world_app.erl +++ b/examples/rest_hello_world/src/rest_hello_world_app.erl @@ -11,11 +11,11 @@ %% API. start(_Type, _Args) -> - Dispatch = [ + Dispatch = cowboy_router:compile([ {'_', [ - {[], toppage_handler, []} + {"/", toppage_handler, []} ]} - ], + ]), {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [ {env, [{dispatch, Dispatch}]} ]), diff --git a/examples/static/src/static_app.erl b/examples/static/src/static_app.erl index e147db97..a2b9c318 100644 --- a/examples/static/src/static_app.erl +++ b/examples/static/src/static_app.erl @@ -11,14 +11,14 @@ %% API. start(_Type, _Args) -> - Dispatch = [ + Dispatch = cowboy_router:compile([ {'_', [ - {['...'], cowboy_static, [ + {"/[...]", cowboy_static, [ {directory, {priv_dir, static, []}}, {mimetypes, {fun mimetypes:path_to_mimes/2, default}} ]} ]} - ], + ]), {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [ {env, [{dispatch, Dispatch}]} ]),