Просмотр исходного кода

Make examples use the new routing

Loïc Hoguin 12 лет назад
Родитель
Сommit
ab0699ab29

+ 3 - 3
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}]}
 	]),

+ 3 - 3
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}]}

+ 2 - 2
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}]}
 	]),

+ 3 - 3
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}]}
 	]),

+ 3 - 3
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}]}
 	]),

+ 3 - 3
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}]}
 	]),

+ 3 - 3
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}]}
 	]),

+ 3 - 3
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}]}
 	]),