/Knowledge/sources/honojs__hono/llms-full/rpc-server--460443f5a097.md
RPC: Server - hono-docs
RPC: Server Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt server Summary All you need to do on the s...
RPC: Server
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#server
Summary
All you need to do on the server side is to write a validator and create a variable route. The following example uses Zod Validator. ```ts{1} const route = app.po...
Content
All you need to do on the server side is to write a validator and create a variable route. The following example uses Zod Validator.
const route = app.post(
'/posts',
zValidator(
'form',
z.object({
title: z.string(),
body: z.string(),
})
),
(c) => {
// ...
return c.json(
{
ok: true,
message: 'Created!',
},
201
)
}
)
Then, export the type to share the API spec with the Client.
export type AppType = typeof route
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#server",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / RPC > Server",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 47,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "RPC: Server",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}