Skip to content

Instantly share code, notes, and snippets.

@presci
Created July 12, 2012 18:04
Show Gist options
  • Save presci/3099759 to your computer and use it in GitHub Desktop.
Save presci/3099759 to your computer and use it in GitHub Desktop.
cowboy dispatcher config
Dispatch=[
{'_', [
{[<<"static">>, '...'], cowboy_http_static,
[{directory, "./priv"},
{mimetypes, [
{<<".css">>, [<<"text/css">>]},
{<<".js">>, [<<"application/javascript">>]},
{<<".html">>, [<<"text/html">>]}
]}
]},
{['_'],cowboy_bench_handler,[]}
]}
],
case cowboy:start_listener(http, 100,
cowboy_tcp_transport, [{port, Port}],
cowboy_http_protocol, [{dispatch, Dispatch}]) of
{ok, Pid}->
register(cowboybehop, Pid),
io:format("do something useful");
{_,_}->
io:format("failed to start the server")
end,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment