/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-using-with-index-pa-3e91eca4747a-using-with-index-parameter-s0734-c0000.md
Using with index parameter - hono-docs
Using with index parameter Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt using with index param...
Using with index parameter
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#using-with-index-parameter
Summary
You can optionally pass an index parameter to get the route path at a specific position, similar to Array.prototype.at(). ```ts app.all('/api/*', (c, next) => { return next() }) app.get('/api/users/:id', (c) => { console.log(routePath(...
Content
You can optionally pass an index parameter to get the route path at a specific position, similar to Array.prototype.at().
app.all('/api/*', (c, next) => {
return next()
})
app.get('/api/users/:id', (c) => {
console.log(routePath(c, 0)) // '/api/*' (first matched route)
console.log(routePath(c, -1)) // '/api/users/:id' (last matched route)
return c.text('User details')
})