Describe the feature
For nested apps, the matchedRoute context variable only includes the route within the nested app and omits the wildcard route in the main app that matched first.
Say for an app like this:
const app = new H3();
const nestedApp = new H3();
app.all("/api/**", withBase("/api", nestedApp.handler));
nestedApp.get(
"/hello/:id",
defineEventHandler((event) => {
const id = getRouterParam(event, "id");
return `Hello ${id}!`;
}),
);
The matchedRoute read within a middleware/plugin would be:
{
method: "GET",
route: "/hello/:id",
handler: function() { ... },
middleware: undefined,
}
It would be great if there was also a reference to the /api/** route in the main app, so that one can construct the full route path for events, in this case /api/hello/:id.
Additional information
Describe the feature
For nested apps, the
matchedRoutecontext variable only includes the route within the nested app and omits the wildcard route in the main app that matched first.Say for an app like this:
The
matchedRouteread within a middleware/plugin would be:It would be great if there was also a reference to the
/api/**route in the main app, so that one can construct the full route path for events, in this case/api/hello/:id.Additional information