Kind: Function
Source: src/helper/route/index.ts
Part of: Helper
Get matched routes in the handler
matchedRoutes gets the routes that match a handler. Use it when route-aware code needs to inspect the handler’s current route matches before performing follow-up work.
Signature
tsfunction matchedRoutes(c: Context): RouterRoute[]
Parameters
| Name | Type |
|---|---|
c | Context |
Returns: RouterRoute[]
Diagram
mermaidgraph LR Handler[Handler] --> MatchedRoutes[matchedRoutes] MatchedRoutes --> Routes[Matched routes] Routes --> Consumer[Route-aware logic]
Usage
tsimport { matchedRoutes } from './helper/route'
const routes = matchedRoutes(handler)
for (const route of routes) {
console.log(route)
}
AI Coding Instructions
- Pass the handler instance associated with the current request or execution context.
- Treat the returned routes as inspection data for route-aware behavior.
- Keep route matching logic centralized through
matchedRoutesrather than duplicating handler traversal. - Check the route shape before reading route-specific properties in downstream code.
Relationships
- IMPORTS →
GET_MATCH_RESULT - IMPORTS →
getPattern - IMPORTS →
splitRoutingPath
Used by
1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.
Imported by (1)
handler—src/middleware/method-not-allowed/index.ts:133
Was this page helpful?