The children of this route, used for nesting routes.
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.
Allow under
semantics for this route.
Activate websocket
semantics for this route.
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');
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
Route class.