Creates a new Route instance
The AdonisJS application instance
Array of global middleware registered on the router
Configuration options for the route
Define matcher for a given param. If a matcher exists, then we do not override that, since the routes inside a group will set matchers before the group, so they should have priority over the group matchers.
Route.group(() => {
Route.get('/:id', 'handler').where('id', /^[0-9]$/)
}).where('id', /[^a-z$]/)
The /^[0-9]$/
will win over the matcher defined by the group
Define prefix for the route. Calling this method multiple times applies multiple prefixes in the reverse order.
The prefix to add to the route
Current Route instance for method chaining
Define a custom domain for the route. We do not overwrite the domain
unless overwrite
flag is set to true.
Define one or more middleware to be executed before the route handler.
Named middleware can be referenced using the name registered with the router middleware store.
Alias for Route.use
Give a unique name to the route. Assinging a new unique removes the existing name of the route.
Setting prepends to true prefixes the name to the existing name.
Check if the route was marked to be deleted
Mark route as deleted. Deleted routes are not registered with the route store
Get the route name
Get the route pattern
Set the route pattern
Returns the stack of middleware registered on the route. The value is shared by reference.
Returns JSON representation of the route
The route class exposes the APIs for constructing a route using the fluent API.