mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Make examples use the new routing
This commit is contained in:
parent
638638a841
commit
ab0699ab29
8 changed files with 23 additions and 23 deletions
|
@ -11,11 +11,11 @@
|
||||||
%% API.
|
%% API.
|
||||||
|
|
||||||
start(_Type, _Args) ->
|
start(_Type, _Args) ->
|
||||||
Dispatch = [
|
Dispatch = cowboy_router:compile([
|
||||||
{'_', [
|
{'_', [
|
||||||
{[], toppage_handler, []}
|
{"/", toppage_handler, []}
|
||||||
]}
|
]}
|
||||||
],
|
]),
|
||||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||||
{env, [{dispatch, Dispatch}]}
|
{env, [{dispatch, Dispatch}]}
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
%% API.
|
%% API.
|
||||||
|
|
||||||
start(_Type, _Args) ->
|
start(_Type, _Args) ->
|
||||||
Dispatch = [
|
Dispatch = cowboy_router:compile([
|
||||||
{'_', [
|
{'_', [
|
||||||
{[], toppage_handler, []}
|
{"/", toppage_handler, []}
|
||||||
]}
|
]}
|
||||||
],
|
]),
|
||||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||||
{compress, true},
|
{compress, true},
|
||||||
{env, [{dispatch, Dispatch}]}
|
{env, [{dispatch, Dispatch}]}
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
%% API.
|
%% API.
|
||||||
|
|
||||||
start(_Type, _Args) ->
|
start(_Type, _Args) ->
|
||||||
Dispatch = [
|
Dispatch = cowboy_router:compile([
|
||||||
{'_', [
|
{'_', [
|
||||||
{'_', toppage_handler, []}
|
{'_', toppage_handler, []}
|
||||||
]}
|
]}
|
||||||
],
|
]),
|
||||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||||
{env, [{dispatch, Dispatch}]}
|
{env, [{dispatch, Dispatch}]}
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
%% API.
|
%% API.
|
||||||
|
|
||||||
start(_Type, _Args) ->
|
start(_Type, _Args) ->
|
||||||
Dispatch = [
|
Dispatch = cowboy_router:compile([
|
||||||
{'_', [
|
{'_', [
|
||||||
{[], toppage_handler, []}
|
{"/", toppage_handler, []}
|
||||||
]}
|
]}
|
||||||
],
|
]),
|
||||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||||
{env, [{dispatch, Dispatch}]}
|
{env, [{dispatch, Dispatch}]}
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
%% API.
|
%% API.
|
||||||
|
|
||||||
start(_Type, _Args) ->
|
start(_Type, _Args) ->
|
||||||
Dispatch = [
|
Dispatch = cowboy_router:compile([
|
||||||
{'_', [
|
{'_', [
|
||||||
{[], toppage_handler, []}
|
{"/", toppage_handler, []}
|
||||||
]}
|
]}
|
||||||
],
|
]),
|
||||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||||
{env, [{dispatch, Dispatch}]}
|
{env, [{dispatch, Dispatch}]}
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
%% API.
|
%% API.
|
||||||
|
|
||||||
start(_Type, _Args) ->
|
start(_Type, _Args) ->
|
||||||
Dispatch = [
|
Dispatch = cowboy_router:compile([
|
||||||
{'_', [
|
{'_', [
|
||||||
{[], toppage_handler, []}
|
{"/", toppage_handler, []}
|
||||||
]}
|
]}
|
||||||
],
|
]),
|
||||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||||
{env, [{dispatch, Dispatch}]}
|
{env, [{dispatch, Dispatch}]}
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
%% API.
|
%% API.
|
||||||
|
|
||||||
start(_Type, _Args) ->
|
start(_Type, _Args) ->
|
||||||
Dispatch = [
|
Dispatch = cowboy_router:compile([
|
||||||
{'_', [
|
{'_', [
|
||||||
{[], toppage_handler, []}
|
{"/", toppage_handler, []}
|
||||||
]}
|
]}
|
||||||
],
|
]),
|
||||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||||
{env, [{dispatch, Dispatch}]}
|
{env, [{dispatch, Dispatch}]}
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -11,14 +11,14 @@
|
||||||
%% API.
|
%% API.
|
||||||
|
|
||||||
start(_Type, _Args) ->
|
start(_Type, _Args) ->
|
||||||
Dispatch = [
|
Dispatch = cowboy_router:compile([
|
||||||
{'_', [
|
{'_', [
|
||||||
{['...'], cowboy_static, [
|
{"/[...]", cowboy_static, [
|
||||||
{directory, {priv_dir, static, []}},
|
{directory, {priv_dir, static, []}},
|
||||||
{mimetypes, {fun mimetypes:path_to_mimes/2, default}}
|
{mimetypes, {fun mimetypes:path_to_mimes/2, default}}
|
||||||
]}
|
]}
|
||||||
]}
|
]}
|
||||||
],
|
]),
|
||||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||||
{env, [{dispatch, Dispatch}]}
|
{env, [{dispatch, Dispatch}]}
|
||||||
]),
|
]),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue