These are chat archives for synrc/n2o

11th
Jun 2017
Andy
@m-2k
Jun 11 2017 06:33
@221V
-define(INSTANCE,app2).
init([]) ->
    cowboy:start_http(?INSTANCE,?CONFIG:cowboy_nb_acceptors(),port(),env()), ***

port()   -> [ { port, wf:config(app2,port,8000)  } ].
-module(app1_routes).
-include_lib("n2o/include/wf.hrl").
-export([init/2, finish/2]).
-include("app1.hrl").

finish(State, Ctx) -> {ok, State, Ctx}.

init(State, Ctx) ->
    Req=Ctx#cx.req,
    {Port,_Req2} = cowboy_req:port(Req),
    case Port of
        8000 -> {ok, State, Ctx#cx{module=app1_main}};
        8001 -> app2_routes:init(State,Ctx);
        8002 -> app3_routes:init(State,Ctx)
    end.
Namdak Tonpa
@5HT
Jun 11 2017 07:57
:+1: