@absolunet/ioc2.1.0

View on GitHub

Route

The class that describes a route entity.

Constructor

new Route(attributes)

Source:
Route constructor.
Parameters:
Name Type Description
attributes http.RouteAttributes Route attributes.

Methods

name(name)

Source:
Name the route.
Parameters:
Name Type Description
name string The route name.
Returns:
The current route instance.
Type
http.Route

compilePath(parameters)

Source:
Compile path from given parameters.
Parameters:
Name Type Description
parameters object The route parameters.
Returns:
The current route instance.
Type
http.Route

where(…constraints)

Source:
Add a constraint to URL parameter. Can either be a constraint object or two parameters, key and value.
Parameters:
Name Type Attributes Description
constraints string | object <repeatable>
The constraint(s) for the route parameter(s).
Returns:
The current route instance.
Type
http.Route

with(…defaults)

Source:
Give static values to the controller when the route is resolved. Can either be a constraint object or two parameters, key and value.
Parameters:
Name Type Attributes Description
defaults string | object <repeatable>
The default values that will be injected into the action.
Returns:
The current route instance.
Type
http.Route

merge(key, values)

Source:
Merge given value in route attributes.
Parameters:
Name Type Description
key string The key to merge the data into.
values Array.<(string|object)> The values to merge.
Returns:
The current route instance.
Type
http.Route