/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-status-code-be1c010fb064-status-code-s0050-c0000.md

Status code (1) - hono-docs

Status code (1) Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt status code Summary If you explic...

Status code (1)

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

Summary

If you explicitly specify the status code, such as 200 or 404, in c.json(), it will be added as a type for passing to the client. ```ts // server.ts const app = new Hono().get( '/posts', zValidator( 'query', z.object({ id: z.string...

Content

If you explicitly specify the status code, such as 200 or 404, in c.json(), it will be added as a type for passing to the client.

// server.ts
const app = new Hono().get(
  '/posts',
  zValidator(
    'query',
    z.object({
      id: z.string(),
    })
  ),
  async (c) => {
    const { id } = c.req.valid('query')
    const post: Post | undefined = await getPost(id)

    if (post === undefined) {
      return c.json({ error: 'not found' }, 404) // Specify 404
    }

    return c.json({ post }, 200) // Specify 200
  }
)

export type AppType = typeof app

You can get the data by the status code.

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-status-code-be1c010fb064-status-code-s0050-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.