Debian Codegraph @

examples/compress_response/src/compress_response_app.erl

raw
1 %% Feel free to use, reuse and abuse the code in this file.
2
3 %% @private
4 -module(compress_response_app).
5 -behaviour(application).
6
7 %% API.
8 -export([start/2]).
9 -export([stop/1]).
10
11 %% API.
12
13 start(_Type, _Args) ->
14 Dispatch = cowboy_router:compile([
15 {'_', [
16 {"/", toppage_h, []}
17 ]}
18 ]),
19 {ok, _} = cowboy:start_clear(http, [{port, 8080}], #{
20 env => #{dispatch => Dispatch},
21 stream_handlers => [cowboy_compress_h, cowboy_stream_h]
22 }),
23 compress_response_sup:start_link().
24
25 stop(_State) ->
26 ok = cowboy:stop_listener(http).