Skip to content

Instantly share code, notes, and snippets.

@rajapaju
Forked from presci/cowboy_dispather
Created January 26, 2013 21:43
Show Gist options
  • Save rajapaju/4644816 to your computer and use it in GitHub Desktop.
Save rajapaju/4644816 to your computer and use it in GitHub Desktop.
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