matchedRoutes function
Returns all routes that matched the current request — including path-based middleware routes and the matched handler route.
app.mount('/api/*', (c, next) async { await next(); });
app.get('/api/users/:id', (c) {
final routes = matchedRoutes(c);
// e.g. [RouteSpec(ALL /api/*), RouteSpec(GET /api/users/:id)]
return c.json({'total': routes.length});
});
Implementation
List<RouteSpec> matchedRoutes(Context c) => c.matchedRoutes;