aboutsummaryrefslogtreecommitdiffstats
path: root/guide/introduction.md
diff options
context:
space:
mode:
Diffstat (limited to 'guide/introduction.md')
-rw-r--r--guide/introduction.md12
1 files changed, 6 insertions, 6 deletions
diff --git a/guide/introduction.md b/guide/introduction.md
index 871e243..c7f48e2 100644
--- a/guide/introduction.md
+++ b/guide/introduction.md
@@ -77,8 +77,8 @@ Dispatch = [
],
%% Name, NbAcceptors, TransOpts, ProtoOpts
cowboy:start_http(my_http_listener, 100,
- [{port, 8080}],
- [{dispatch, Dispatch}]
+ [{port, 8080}],
+ [{env, [{dispatch, Dispatch}]}]
).
```
@@ -87,7 +87,7 @@ handlers, Websocket handlers, REST handlers and static handlers. Their
usage is documented in the respective sections of the guide.
Most applications use the plain HTTP handler, which has three callback
-functions: init/3, handle/2 and terminate/2. Following is an example of
+functions: init/3, handle/2 and terminate/3. Following is an example of
a simple handler module.
``` erlang
@@ -96,7 +96,7 @@ a simple handler module.
-export([init/3]).
-export([handle/2]).
--export([terminate/2]).
+-export([terminate/3]).
init({tcp, http}, Req, Opts) ->
{ok, Req, undefined_state}.
@@ -105,10 +105,10 @@ handle(Req, State) ->
{ok, Req2} = cowboy_req:reply(200, [], <<"Hello World!">>, Req),
{ok, Req2, State}.
-terminate(Req, State) ->
+terminate(Reason, Req, State) ->
ok.
```
The `Req` variable above is the Req object, which allows the developer
-to obtain informations about the request and to perform a reply. Its usage
+to obtain information about the request and to perform a reply. Its usage
is explained in its respective section of the guide.