Skip to main content
@usenarrator/plugin-hono The Hono plugin reads an app the way you would describe an API to a colleague: which routes it answers, what each handler reads from the request, and what it replies with. It also covers middleware, validation, the typed RPC client and streaming.
The plugin declares library: { name: "hono", versions: ">=4 <6" }. It only narrates Hono APIs in files that import from hono or belong to a package that depends on it (see Dependency detection), so get, json and use calls in an Express app are left alone.

Examples

A route that reads the request and replies
English
Built-in and inline middleware
English
Validation with zValidator
English
The RPC client
English

What it covers

  • Apps: new Hono() with its generics and options, basePath, route, chained route groups, and export default app.
  • Routes: get, post, put, patch, delete, on, all, and path lists.
  • The context: path, query, header and body reads, c.json, c.text, c.html, c.redirect, c.body, headers and status, c.set and c.get, bindings and executionCtx.waitUntil.
  • Errors: onError, notFound and HTTPException.
  • Middleware: the built-in middleware by what it does, inline middleware around next(), createMiddleware, and factories.
  • Validation: zValidator and validator, naming the part of the request that is checked.
  • The RPC client hc, streaming helpers (SSE, text and byte streams), cookie helpers, and server adapters for Node and Bun.

Translating

The English phrasebook is exported as en and typed as HonoPhrases.