/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-path-parameters-a2a4cb5356ac-path-parameters-s0053-c0000.md

Path parameters - hono-docs

Path parameters Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt path parameters Summary You can a...

Path parameters

Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#path-parameters

Summary

You can also handle routes that include path parameters or query values. ```ts const route = app.get( '/posts/:id', zValidator( 'query', z.object({ page: z.coerce.number().optional(), // coerce to convert to number }) ), (c) => { // ......

Content

You can also handle routes that include path parameters or query values.

const route = app.get(
  '/posts/:id',
  zValidator(
    'query',
    z.object({
      page: z.coerce.number().optional(), // coerce to convert to number
    })
  ),
  (c) => {
    // ...
    return c.json({
      title: 'Night',
      body: 'Time to sleep',
    })
  }
)

Both path parameters and query values must be passed as string, even if the underlying value is of a different type.

Specify the string you want to include in the path with param, and any query values with query.

const res = await client.posts[':id'].$get({
  param: {
    id: '123',
  },
  query: {
    page: '1', // `string`, converted by the validator to `number`
  },
})
Kinic Wiki
Loading knowledge node
Details

Identity

database
db_23dhmsxlhukv
database_id
db_23dhmsxlhukv
path
/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-path-parameters-a2a4cb5356ac-path-parameters-s0053-c0000.md
kind
directory
role
markdown_note
children
0

Metadata

created_at
virtual
updated_at
virtual
etag
virtual
metadata_json
{}

Lint Hints

No lightweight warnings.

Outgoing Links

No outgoing links indexed.

Incoming Links

Select a file node to inspect backlinks.

Raw Source

No raw source path inferred.