Improved
- qol: Wildcard (
*
) route segments now populate a'*'
key inctx.state
, capturing the matched tail path.
app.get('/docs/*', ctx => {
const rest = ctx.state['*']; // e.g. 'getting-started/setup'
return ctx.text(`Matched path: ${rest}`);
});
app.get('/blog/:year/:month/*', ctx => {
const { year, month, '*': slugPath } = ctx.state;
return ctx.json({ year, month, slugPath });
});
Request to
/blog/2024/07/post/deep/title
yields:{year: "2024", month: "07", slugPath: "post/deep/title"}