diff options
author | Loïc Hoguin <[email protected]> | 2013-01-07 22:42:16 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-01-07 22:42:16 +0100 |
commit | 01f57ad65d7c75fb455f48e354bb3a328c472ce4 (patch) | |
tree | e82833c9b0a1db0f4a82f95244ddb905f4fdaebc /examples/compress_response/src/compress_response_app.erl | |
parent | a013becc66b50db038c1f7f3539040b4482bba18 (diff) | |
download | cowboy-01f57ad65d7c75fb455f48e354bb3a328c472ce4.tar.gz cowboy-01f57ad65d7c75fb455f48e354bb3a328c472ce4.tar.bz2 cowboy-01f57ad65d7c75fb455f48e354bb3a328c472ce4.zip |
Add optional automatic response body compression
This behavior can be enabled with the `compress` protocol option.
See the `compress_response` example for more details.
All tests are now ran with and without compression for both HTTP
and HTTPS.
Diffstat (limited to 'examples/compress_response/src/compress_response_app.erl')
-rw-r--r-- | examples/compress_response/src/compress_response_app.erl | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/compress_response/src/compress_response_app.erl b/examples/compress_response/src/compress_response_app.erl new file mode 100644 index 0000000..b5f3054 --- /dev/null +++ b/examples/compress_response/src/compress_response_app.erl @@ -0,0 +1,26 @@ +%% 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) -> + Dispatch = [ + {'_', [ + {[], toppage_handler, []} + ]} + ], + {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [ + {compress, true}, + {env, [{dispatch, Dispatch}]} + ]), + compress_response_sup:start_link(). + +stop(_State) -> + ok. |