Skip to content

Instantly share code, notes, and snippets.

@sumerman
Created September 25, 2012 11:59
Show Gist options
  • Save sumerman/3781343 to your computer and use it in GitHub Desktop.
Save sumerman/3781343 to your computer and use it in GitHub Desktop.
Sample cowboy (0.6.x) config(s)
cowboy_config() ->
{ok, App} = application:get_application(),
Disp = [
{'_', [
{[<<"combiners">>, <<"test">>], combiner_test_src, []},
{[<<"combiners">>, <<"list">>], combiners_list, []},
{[<<"combiners">>, <<"info">>, comb_name], combiner_info, []},
{[<<"combiners">>, '...'], cowboy_http_static, [
{directory, {priv_dir, App, []}},
{mimetypes, [
{<<".html">>, [<<"text/html">>]},
{<<".htm">>, [<<"text/html">>]},
{<<".css">>, [<<"text/css">>]},
{<<".js">>, [<<"application/javascript">>]}]}
]}
]}
],
Port = ?GET_CFG(port, []),
cowboy:start_listener(my_http, ?ACCEPTORS_COUT,
cowboy_tcp_transport, [{port, Port}],
cowboy_http_protocol, [{dispatch, Disp}]
).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment