trails
.
metadata(X) = #{method() => X}
method() = get | put | post | delete | patch | head | options
route_match() = '_' | iodata()
route_path() = {Path::route_match(), Handler::module(), Opts::any()} | {Path::route_match(), cowboy:fields(), Handler::module(), Opts::any()}
abstract datatype: trail()
trails() = [trail() | route_path()]
all/0 | Retrieves all stored trails. |
all/1 | Retrieves all stored trails for the given HostMatch |
all/2 | Retrieves all stored trails for the given Server and HostMatch |
api_root/0 | Get api_root env param value if any, empty otherwise. |
api_root/1 | Set api_root env param to the given Path. |
compile/1 | Compiles the given list of trails routes, also compatible with
cowboy routes. |
constraints/1 | Gets the constraints from the given trail . |
handler/1 | Gets the handler from the given trail . |
host_matches/1 | |
metadata/1 | Gets the metadata from the given trail . |
options/1 | Gets the options from the given trail . |
path_match/1 | Gets the path_match from the given trail . |
retrieve/1 | Fetch the trail that matches with the given path. |
retrieve/2 | Fetch the trail that matches with the given host and path. |
retrieve/3 | Fetch the trail that matches with the given server and host and path. |
servers/0 | |
single_host_compile/1 | Equivalent to compile([{'_', Trails}]). |
store/1 | Store the given list of trails. |
store/2 | |
trail/2 | Equivalent to trail(PathMatch, ModuleHandler, [], #{}, []). |
trail/3 | Equivalent to trail(PathMatch, ModuleHandler, Options, #{}, []). |
trail/4 | Equivalent to trail(PathMatch, ModuleHandler, Options, MetaData, []). |
trail/5 | This function allows you to add additional information to the
cowboy handler, such as: resource path, handler module,
options and metadata. |
trails/1 | This function allows you to define the routes on each resource handler,
instead of defining them all in one place (as you're required to do
with cowboy ). |
all() -> [trail()]
Retrieves all stored trails.
all(HostMatch::route_match()) -> [trail()]
Retrieves all stored trails for the given HostMatch
all(Server::ranch:ref(), HostMatch::route_match()) -> [trail()]
Retrieves all stored trails for the given Server
and HostMatch
api_root() -> string()
Get api_root env param value if any, empty otherwise.
api_root(Path::string()) -> ok
Set api_root env param to the given Path.
compile(Routes::[{Host::route_match(), Trails::trails()}]) -> cowboy_router:dispatch_rules()
Compiles the given list of trails routes, also compatible with
cowboy
routes.
constraints(Trail::trail()) -> cowboy:fields()
Gets the constraints
from the given trail
.
handler(Trail::trail()) -> module()
Gets the handler
from the given trail
.
host_matches(ServerRef::ranch:ref()) -> [route_match()]
metadata(Trail::trail()) -> map()
Gets the metadata
from the given trail
.
options(Trail::trail()) -> any()
Gets the options
from the given trail
.
path_match(Trail::trail()) -> route_match()
Gets the path_match
from the given trail
.
retrieve(PathMatch::string()) -> trail() | notfound
Fetch the trail that matches with the given path.
retrieve(HostMatch::route_match(), PathMatch::string()) -> trail() | notfound
Fetch the trail that matches with the given host and path.
retrieve(Server::ranch:ref(), HostMatch::route_match(), PathMatch::string()) -> trail() | notfound
Fetch the trail that matches with the given server and host and path.
servers() -> [ranch:ref()]
single_host_compile(Trails::trails()) -> cowboy_router:dispatch_rules()
Equivalent to compile([{'_', Trails}]).
store(Trails::trails() | [{HostMatch::route_match(), Trails::trails()}]) -> ok
Store the given list of trails.
store(Server::ranch:ref(), Trails::trails() | [{HostMatch::route_match(), Trails::trails()}]) -> ok
trail(PathMatch::route_match(), ModuleHandler::module()) -> trail()
Equivalent to trail(PathMatch, ModuleHandler, [], #{}, []).
trail(PathMatch::route_match(), ModuleHandler::module(), Options::any()) -> trail()
Equivalent to trail(PathMatch, ModuleHandler, Options, #{}, []).
trail(PathMatch::route_match(), ModuleHandler::module(), Options::any(), MetaData::map()) -> trail()
Equivalent to trail(PathMatch, ModuleHandler, Options, MetaData, []).
trail(PathMatch::route_match(), ModuleHandler::module(), Options::any(), MetaData::map(), Constraints::cowboy:fields()) -> trail()
This function allows you to add additional information to the
cowboy
handler, such as: resource path, handler module,
options and metadata. Normally used to document handlers.
trails(Handlers::module() | [module()]) -> trails()
This function allows you to define the routes on each resource handler,
instead of defining them all in one place (as you're required to do
with cowboy
). Your handler must implement the callback trails/0
and return the specific routes for that handler. That callback is
invoked for each given module and then the results are concatenated.
Generated by EDoc