mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Switch to Ranch for connection handling
This is the first of many API incompatible changes. You have been warned.
This commit is contained in:
parent
50e5a616dc
commit
e4124de2c7
35 changed files with 133 additions and 1066 deletions
|
@ -8,5 +8,6 @@
|
|||
%% API.
|
||||
|
||||
start() ->
|
||||
ok = application:start(ranch),
|
||||
ok = application:start(cowboy),
|
||||
ok = application:start(chunked_hello_world).
|
||||
|
|
|
@ -16,10 +16,9 @@ start(_Type, _Args) ->
|
|||
{[], toppage_handler, []}
|
||||
]}
|
||||
],
|
||||
{ok, _} = cowboy:start_listener(http, 100,
|
||||
cowboy_tcp_transport, [{port, 8080}],
|
||||
cowboy_http_protocol, [{dispatch, Dispatch}]
|
||||
),
|
||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||
{dispatch, Dispatch}
|
||||
]),
|
||||
chunked_hello_world_sup:start_link().
|
||||
|
||||
stop(_State) ->
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
%% API.
|
||||
|
||||
start() ->
|
||||
ok = application:start(ranch),
|
||||
ok = application:start(cowboy),
|
||||
ok = application:start(echo_get).
|
||||
|
|
|
@ -16,10 +16,9 @@ start(_Type, _Args) ->
|
|||
{[], toppage_handler, []}
|
||||
]}
|
||||
],
|
||||
{ok, _} = cowboy:start_listener(http, 100,
|
||||
cowboy_tcp_transport, [{port, 8080}],
|
||||
cowboy_http_protocol, [{dispatch, Dispatch}]
|
||||
),
|
||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||
{dispatch, Dispatch}
|
||||
]),
|
||||
echo_get_sup:start_link().
|
||||
|
||||
stop(_State) ->
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
%% API.
|
||||
|
||||
start() ->
|
||||
ok = application:start(ranch),
|
||||
ok = application:start(cowboy),
|
||||
ok = application:start(echo_post).
|
||||
|
|
|
@ -16,10 +16,9 @@ start(_Type, _Args) ->
|
|||
{[], toppage_handler, []}
|
||||
]}
|
||||
],
|
||||
{ok, _} = cowboy:start_listener(http, 100,
|
||||
cowboy_tcp_transport, [{port, 8080}],
|
||||
cowboy_http_protocol, [{dispatch, Dispatch}]
|
||||
),
|
||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||
{dispatch, Dispatch}
|
||||
]),
|
||||
echo_post_sup:start_link().
|
||||
|
||||
stop(_State) ->
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
erl -pa ebin deps/*/ebin -s echo_post \
|
||||
-eval "io:format(\"Run ./curl_post.sh STRING_TO_ECHO\")."
|
||||
-eval "io:format(\"Run ./curl_post.sh STRING_TO_ECHO~n\")."
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
%% API.
|
||||
|
||||
start() ->
|
||||
ok = application:start(ranch),
|
||||
ok = application:start(cowboy),
|
||||
ok = application:start(hello_world).
|
||||
|
|
|
@ -16,10 +16,9 @@ start(_Type, _Args) ->
|
|||
{[], toppage_handler, []}
|
||||
]}
|
||||
],
|
||||
{ok, _} = cowboy:start_listener(http, 100,
|
||||
cowboy_tcp_transport, [{port, 8080}],
|
||||
cowboy_http_protocol, [{dispatch, Dispatch}]
|
||||
),
|
||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||
{dispatch, Dispatch}
|
||||
]),
|
||||
hello_world_sup:start_link().
|
||||
|
||||
stop(_State) ->
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
%% API.
|
||||
|
||||
start() ->
|
||||
ok = application:start(ranch),
|
||||
ok = application:start(cowboy),
|
||||
ok = application:start(rest_hello_world).
|
||||
|
|
|
@ -16,10 +16,9 @@ start(_Type, _Args) ->
|
|||
{[], toppage_handler, []}
|
||||
]}
|
||||
],
|
||||
{ok, _} = cowboy:start_listener(http, 100,
|
||||
cowboy_tcp_transport, [{port, 8080}],
|
||||
cowboy_http_protocol, [{dispatch, Dispatch}]
|
||||
),
|
||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||
{dispatch, Dispatch}
|
||||
]),
|
||||
rest_hello_world_sup:start_link().
|
||||
|
||||
stop(_State) ->
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
%% API.
|
||||
|
||||
start() ->
|
||||
ok = application:start(ranch),
|
||||
ok = application:start(cowboy),
|
||||
ok = application:start(static).
|
||||
|
|
|
@ -18,10 +18,9 @@ start(_Type, _Args) ->
|
|||
]}
|
||||
]}
|
||||
],
|
||||
{ok, _} = cowboy:start_listener(http, 100,
|
||||
cowboy_tcp_transport, [{port, 8080}],
|
||||
cowboy_http_protocol, [{dispatch, Dispatch}]
|
||||
),
|
||||
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
||||
{dispatch, Dispatch}
|
||||
]),
|
||||
static_sup:start_link().
|
||||
|
||||
stop(_State) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue