View Source nova_router behaviour (nova v0.10.1)

Summary

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.
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.
-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().
Link to this function

lookup_url(Host, Path, Method)

View Source
Link to this function

render_status_page(StatusCode, Req)

View Source
-spec render_status_page(StatusCode :: integer(), Req :: cowboy_req:req()) ->
                      {ok, Req0 :: cowboy_req:req(), Env :: map()}.
Link to this function

render_status_page(StatusCode, Data, Req)

View Source
-spec render_status_page(StatusCode :: integer(), Data :: map(), Req :: cowboy_req:req()) ->
                      {ok, Req0 :: cowboy_req:req(), Env :: map()}.
Link to this function

render_status_page(Host, StatusCode, Data, Req, Env)

View Source
-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()].