inaka / cowboy-trails

A couple of improvements over Cowboy Routes

Home Page:http://inaka.github.io/cowboy-trails/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to pass options?

joaohf opened this issue · comments

Hi,

Using cowboy, withou cowboy-swagger I used to pass an Option to cowboy handlers. Like this:

 Opts = get_handler_options(HttpConfig),
Dispatch = cowboy_router:compile([
                                      {'_', [ {"/nodes/[:type]", location, Opts},
....

How to achieve the same using trails ?

Thanks.

@joaohf you have to add those options to each trail, like this:

Opts = get_handler_options(HttpConfig),
Trails = [trails:trail("/nodes/[:type]", location, Opts)],
Dispatch = trails:single_host_compile(Trails),
…