web_sup.erl 635 B

1234567891011121314151617
  1. -module(web_sup).
  2. -behaviour(supervisor).
  3. -export([start_link/0, init/1]).
  4. start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, []).
  5. mime() -> [{mimetypes,cow_mimetypes,all}].
  6. rules() -> cowboy_router:compile(
  7. [{'_', [
  8. {"/static/[...]", n2o_dynalo, {dir, "apps/sample/priv/static", mime()}},
  9. {"/n2o/[...]", n2o_dynalo, {dir, "deps/n2o/priv", mime()}},
  10. {"/ws/[...]", bullet_handler, [{handler, n2o_bullet}]},
  11. {'_', n2o_cowboy, []}
  12. ]}]).
  13. init([]) ->
  14. cowboy:start_http(http, 3, [{port, wf:config(n2o,port)}], [{env, [{dispatch, rules()}]}]),
  15. {ok, {{one_for_one, 5, 10}, []}}.