Skip to main content
The Route Helper provides utilities for accessing information about matched routes and base paths.

Import

Functions

matchedRoutes()

Get all matched routes for the current request.
Context
required
The context object
number
Optional index to get a specific route (supports negative indices)
RouterRoute | RouterRoute[] | undefined
The matched route(s) or undefined if index is out of range
Example

routePath()

Get the matched route path.
Context
required
The context object
string | undefined
The route path (e.g., ‘/api/:id’)

baseRoutePath()

Get the base route path from the routes array.
Context
required
The context object
string | undefined
The base route path

basePath()

Get the base path from the request.
Context
required
The context object
string
The base path (e.g., ‘/api’)

Types