2013-01-07 22:42:16 +01:00
|
|
|
%% Feel free to use, reuse and abuse the code in this file.
|
|
|
|
|
|
|
|
%% @private
|
|
|
|
-module(compress_response_app).
|
|
|
|
-behaviour(application).
|
|
|
|
|
|
|
|
%% API.
|
|
|
|
-export([start/2]).
|
|
|
|
-export([stop/1]).
|
|
|
|
|
|
|
|
%% API.
|
|
|
|
|
|
|
|
start(_Type, _Args) ->
|
2013-01-29 14:47:17 +01:00
|
|
|
Dispatch = cowboy_router:compile([
|
2013-01-07 22:42:16 +01:00
|
|
|
{'_', [
|
2013-01-29 14:47:17 +01:00
|
|
|
{"/", toppage_handler, []}
|
2013-01-07 22:42:16 +01:00
|
|
|
]}
|
2013-01-29 14:47:17 +01:00
|
|
|
]),
|
2017-06-07 15:15:54 +02:00
|
|
|
{ok, _} = cowboy:start_clear(http, [{port, 8080}], #{
|
2017-01-22 20:17:52 +01:00
|
|
|
env => #{dispatch => Dispatch},
|
|
|
|
stream_handlers => [cowboy_compress_h, cowboy_stream_h]
|
|
|
|
}),
|
2013-01-07 22:42:16 +01:00
|
|
|
compress_response_sup:start_link().
|
|
|
|
|
|
|
|
stop(_State) ->
|
|
|
|
ok.
|