compile(cowboy_router:routes()) -> cowboy_router:dispatch_rules()
cowboy_router:compile - Compile routes to the resources
compile(cowboy_router:routes()) -> cowboy_router:dispatch_rules()
Compile routes to the resources.
Takes a human readable list of routes and transforms it into a form more efficient to process.
Human readable list of routes.
An opaque dispatch rules value is returned. This value must be given to Cowboy as a middleware environment value.
Dispatch = cowboy_router:compile([ {'_', [ {"/", toppage_h, []}, {"/[...]", cowboy_static, {priv_dir, my_example_app, ""}} ]} ]), {ok, _} = cowboy:start_clear(example, [{port, 8080}], #{ env => #{dispatch => Dispatch} }).
Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:
Recurring payment options are also available via BountySource. These funds are used to cover the recurring expenses like dedicated servers or domain names.