mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Use spaces in snippets in the guide
This commit is contained in:
parent
a231216b07
commit
31cabe0fb9
10 changed files with 104 additions and 104 deletions
|
@ -91,14 +91,14 @@ code to the `start/2` function to make it look like this:
|
|||
[source,erlang]
|
||||
----
|
||||
start(_Type, _Args) ->
|
||||
Dispatch = cowboy_router:compile([
|
||||
{'_', [{"/", hello_handler, []}]}
|
||||
]),
|
||||
{ok, _} = cowboy:start_clear(my_http_listener, 100,
|
||||
[{port, 8080}],
|
||||
#{env => #{dispatch => Dispatch}}
|
||||
),
|
||||
hello_erlang_sup:start_link().
|
||||
Dispatch = cowboy_router:compile([
|
||||
{'_', [{"/", hello_handler, []}]}
|
||||
]),
|
||||
{ok, _} = cowboy:start_clear(my_http_listener, 100,
|
||||
[{port, 8080}],
|
||||
#{env => #{dispatch => Dispatch}}
|
||||
),
|
||||
hello_erlang_sup:start_link().
|
||||
----
|
||||
|
||||
Routes are explained in details in the xref:routing[Routing]
|
||||
|
@ -127,11 +127,11 @@ the `init/2` function like this to send a reply.
|
|||
[source,erlang]
|
||||
----
|
||||
init(Req0, State) ->
|
||||
Req = cowboy_req:reply(200,
|
||||
#{<<"content-type">> => <<"text/plain">>},
|
||||
<<"Hello Erlang!">>,
|
||||
Req0),
|
||||
{ok, Req, State}.
|
||||
Req = cowboy_req:reply(200,
|
||||
#{<<"content-type">> => <<"text/plain">>},
|
||||
<<"Hello Erlang!">>,
|
||||
Req0),
|
||||
{ok, Req, State}.
|
||||
----
|
||||
|
||||
What the above code does is send a `200 OK` reply, with the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue