Routing cache.
The children of this route, used for nesting routes.
Contains all available conditions.
Directories to look for controllers in, first one has the highest precedence.
Already loaded controllers.
Custom route name, if defined.
Default route name.
Restrict HTTP methods this route is allowed to handle, defaults to no restrictions.
Pattern for this route.
Activate conditions for this route.
Registered placeholder types, by default only num
is already defined.
Allow under
semantics for this route.
Activate websocket
semantics for this route.
Register a placeholder type.
Generate route matching any of the listed HTTP request methods or all.
Rest
...args: AnyArguments// Route with pattern and destination
route.any('/user').to('User#whatever');
// Route with HTTP methods, pattern, restrictive placeholders and destination
route.any(['DELETE', 'PUT'], '/:foo', {foo: /\w+/}).to('Foo#bar');
// Route with pattern, name and destination
route.any('/:foo').name('foo_route').to('Foo#bar');
// Route with pattern, condition and destination
route.any('/').requires({agent: /Firefox/}).to('Foo#bar');
// Route with pattern and a closure as destination
route.any('/:foo', async ctx => ctx.render({text: 'Hello World!'}));
Generate route matching only DELETE
requests.
Rest
...args: RouteArguments// Route with destination
route.delete('/user').to('User#remove');
Match routes and dispatch to actions with and without controllers.
Generate route matching only GET
requests.
Rest
...args: RouteArguments// Route with destination
route.get('/user').to('User#show');
Generate route matching only OPTIONS
requests.
Rest
...args: RouteArguments// Route with destination
route.options('/user').to('User#overview');
Generate route matching only PATCH
requests.
Rest
...args: RouteArguments// Route with destination
route.patch('/user').to('User#update');
Generate route matching only POST
requests.
Rest
...args: RouteArguments// Route with destination
route.post('/user').to('User#create');
Generate route matching only PUT
requests.
Rest
...args: RouteArguments// Route with destination
route.put('/user').to('User#replace');
Set default parameters for this route.
Rest
...targets: (string | Record<string, any> | MojoAction)[]Generate route for a nested route with its own intermediate destination.
Rest
...args: AnyArguments// Intermediate destination and prefix shared between two routes
const auth = app.under('/user').to('User#auth');
auth.get('/show').to('User#show');
auth.post('/create').to('User#create');
Generate route matching only WebSocket handshake requests.
Rest
...args: RouteArguments// Route with destination
app.websocket('/echo').to('Example#echo');
Generated using TypeDoc
Router class.