Skip to content

Instantly share code, notes, and snippets.

@jlouis
Created May 6, 2016 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlouis/e2e05747fba248fd309a81f6007bcaa8 to your computer and use it in GitHub Desktop.
Save jlouis/e2e05747fba248fd309a81f6007bcaa8 to your computer and use it in GitHub Desktop.
-module(z_app).
-behaviour(application)
-export([start/2, prep_stop/1]).
start(_StartType, _StartArgs) ->
{ok, Pid} = z_sup:start_link(),
Dispatch = …,
cowboy:start_http(z_app_listener, 100,
[{port, 8080}],
[{middlewares, [
cowboy_router,
cowboy_cors,
cowboy_handler
]},
{env, [
{cors_policy, z_policy},
{dispatch, Dispatch}]}]),
{ok, Pid}.
prep_stop(_State) ->
cowboy:stop_listener(z_app_listener),
ok.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment