View Source nova_router behaviour (nova v0.10.1)
Summary
Functions
Add routes to the dispatch-table for the given app. The routes can be either a list of maps or a map. It use the same structure as the routes-callback in the router-module.
Types
-type bindings() :: #{binary() := binary()}.
-type host_tree() :: #host_tree{}.
-type options() :: #{convert_to_binary := boolean(), use_strict := boolean()}.
-type routing_tree() :: #routing_tree{}.
Callbacks
-callback routes(Env :: atom()) -> Routes :: [map()].
Functions
-spec add_routes(App :: atom(), Routes :: [map()] | map()) -> ok.
-spec compile(Apps :: [atom() | {atom(), map()}]) -> host_tree().
-spec compiled_apps() -> [{App :: atom(), Prefix :: list()}].
-spec execute(Req, Env :: cowboy_middleware:env()) -> {ok, Req, Env0} | {stop, Req} when Req :: cowboy_req:req(), Env0 :: cowboy_middleware:env().
-spec render_status_page(StatusCode :: integer(), Req :: cowboy_req:req()) -> {ok, Req0 :: cowboy_req:req(), Env :: map()}.
-spec render_status_page(StatusCode :: integer(), Data :: map(), Req :: cowboy_req:req()) -> {ok, Req0 :: cowboy_req:req(), Env :: map()}.
-spec render_status_page(Host :: binary() | atom(), StatusCode :: integer(), Data :: map(), Req :: cowboy_req:req(), Env :: map()) -> {ok, Req0 :: cowboy_req:req(), Env :: map()}.
-spec routes(Env :: atom()) -> [map()].