0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Removed a few lines from the README for pedantic correctness.

This commit is contained in:
Loïc Hoguin 2011-05-07 16:19:01 +02:00
parent 078ab340e9
commit 39513deaca

View file

@ -64,28 +64,21 @@ Don't worry about it right now though and continue reading, it'll all
be explained.
You can start and stop listeners by calling `cowboy:start_listener/6` and
`cowboy:stop_listener/1` respectively, as demonstrated in the following
example.
`cowboy:stop_listener/1` respectively.
The following example demonstrates the startup of a very simple listener.
``` erlang
-module(my_app).
-behaviour(application).
-export([start/2, stop/1]).
start(_Type, _Args) ->
application:start(cowboy),
Dispatch = [
%% {Host, list({Path, Handler, Opts})}
{'_', [{'_', my_handler, []}]}
],
%% Name, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts
cowboy:start_listener(http, 100,
cowboy_tcp_transport, [{port, 8080}],
cowboy_http_protocol, [{dispatch, Dispatch}]
).
stop(_State) ->
ok.
application:start(cowboy),
Dispatch = [
%% {Host, list({Path, Handler, Opts})}
{'_', [{'_', my_handler, []}]}
],
%% Name, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts
cowboy:start_listener(http, 100,
cowboy_tcp_transport, [{port, 8080}],
cowboy_http_protocol, [{dispatch, Dispatch}]
).
```
This is not enough though, you must also write the my_handler module