mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 04:30:25 +00:00
Merge branch 'fix_routing_guide' of https://github.com/ivlis/cowboy
This commit is contained in:
commit
eaaa81cce6
1 changed files with 2 additions and 2 deletions
|
@ -229,14 +229,14 @@ handler to run instead of having to parse the routes repeatedly.
|
||||||
This can be done with a simple call to `cowboy_router:compile/1`.
|
This can be done with a simple call to `cowboy_router:compile/1`.
|
||||||
|
|
||||||
``` erlang
|
``` erlang
|
||||||
{ok, Routes} = cowboy_router:compile([
|
Dispatch = cowboy_router:compile([
|
||||||
%% {HostMatch, list({PathMatch, Handler, Opts})}
|
%% {HostMatch, list({PathMatch, Handler, Opts})}
|
||||||
{'_', [{'_', my_handler, []}]}
|
{'_', [{'_', my_handler, []}]}
|
||||||
]),
|
]),
|
||||||
%% Name, NbAcceptors, TransOpts, ProtoOpts
|
%% Name, NbAcceptors, TransOpts, ProtoOpts
|
||||||
cowboy:start_http(my_http_listener, 100,
|
cowboy:start_http(my_http_listener, 100,
|
||||||
[{port, 8080}],
|
[{port, 8080}],
|
||||||
[{env, [{routes, Routes}]}]
|
[{env, [{dispatch, Dispatch}]}]
|
||||||
).
|
).
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue