mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 04:30:25 +00:00
Convert the hello world example to a release
This commit is contained in:
parent
7ab12d1b66
commit
335676876b
7 changed files with 36 additions and 36 deletions
|
@ -1,15 +0,0 @@
|
|||
%% Feel free to use, reuse and abuse the code in this file.
|
||||
|
||||
-module(hello_world).
|
||||
|
||||
%% API.
|
||||
-export([start/0]).
|
||||
|
||||
%% API.
|
||||
|
||||
start() ->
|
||||
ok = application:start(crypto),
|
||||
ok = application:start(cowlib),
|
||||
ok = application:start(ranch),
|
||||
ok = application:start(cowboy),
|
||||
ok = application:start(hello_world).
|
|
@ -7,11 +7,13 @@
|
|||
-export([handle/2]).
|
||||
-export([terminate/3]).
|
||||
|
||||
init(_Transport, Req, []) ->
|
||||
init(_Type, Req, []) ->
|
||||
{ok, Req, undefined}.
|
||||
|
||||
handle(Req, State) ->
|
||||
{ok, Req2} = cowboy_req:reply(200, [], <<"Hello world!">>, Req),
|
||||
{ok, Req2} = cowboy_req:reply(200, [
|
||||
{<<"content-type">>, <<"text/plain">>}
|
||||
], <<"Hello world!">>, Req),
|
||||
{ok, Req2, State}.
|
||||
|
||||
terminate(_Reason, _Req, _State) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue