en un clic
hono-knowledge-patch
Hono
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Menu
Hono
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Basé sur la classification professionnelle SOC
AlmaLinux
Angular
Arch Linux
Astro
Auth.js
AWS SDK
| name | hono-knowledge-patch |
| description | Hono |
| license | MIT |
| version | 4.12.0 |
| metadata | {"author":"Nevaberry"} |
Baseline: Hono through v4.7.x (core routing, middleware, hc, JSX/SSR, WebSocket helpers, and Cloudflare Workers/Pages, Deno, Bun, and Node.js adapters); covered range: v4.8.0 through v4.12.x plus the included topical guidance current to 2026-07-12.
| Reference | Topics |
|---|---|
| Routing and requests | HEAD dispatch, route introspection, trailing slashes, raw requests and bytes, query/body behavior, proxy headers, locale fallback, Unix sockets |
| Client, RPC, validation, and testing | hc URLs and inputs, response typing/parsing, query serialization, validator rules, Standard Schema, testClient, app.request() |
| Security and authentication | JWT/JWK algorithms and sources, Basic Auth hooks, CSP, bot blocking, security patch floors |
| Middleware, runtimes, and integrations | cache, CORS, compression, context exports, adapters, Service Workers, MCP, MIME and logging |
| Rendering, streaming, and SSG | streaming lifecycle, SSG plugins and route mapping, JSX DOM, view transitions, renderer and CSS options |
| Hono CLI | docs, search, request, serve, and optimize commands |
From v4.11.4 in the 4.11.0 line, configure the algorithm instead of allowing a token header to select it. jwt takes one alg; jwk takes an array of asymmetric algorithms.
import { jwk } from 'hono/jwk'
import { jwt } from 'hono/jwt'
app.use('/session/*', jwt({ secret, alg: 'HS256' }))
app.use('/admin/*', jwk({ jwks_uri, alg: ['RS256'] }))
Use v4.11.7 or newer for the 4.11 security fixes and v4.11.10 or newer for stronger timing-safe comparison. On 4.12, use at least v4.12.27 for the accumulated security fixes. See Security and authentication for the affected features.
Start Service Worker apps with the standalone helper introduced in 4.8.0; do not add new uses of app.fire().
import { fire } from 'hono/service-worker'
fire(app)
Pass SSGPlugin objects in toSSG(..., { plugins }). Legacy SSG hook options are deprecated as of 4.9.0. Use defaultPlugin() for normal generation and put redirectPlugin() before it when generating redirect pages.
HEAD request is converted to GET before matching, and its response body is removed. Put HEAD-specific work in middleware that inspects c.req.method; app.head() and app.on('HEAD', ...) do not run.{} when the request lacks the matching Content-Type; header validation keys are lowercase.hc does not URL-encode path parameters. Encode normal values yourself, or intentionally use a regexp parameter when a raw value may span slashes.Pass a literal base URL as the second hc type argument to make $url() return an exact TypedURL (since 4.11.0).
const client = hc<typeof app, 'https://api.example.com'>(
'https://api.example.com/'
)
const url = client.posts[':id'].$url({ param: { id: '42' } })
Use $path() when only a router path or cache key is needed (since 4.12.0).
const path = client.posts[':id'].$path({
param: { id: '42' },
query: { view: 'full' },
})
Use buildSearchParams on hc for custom query conventions. Keep all param and query values as strings. Per-call { init } has final precedence over the method, body, and headers generated by hc.
Use ApplyGlobalResponse to add responses from global middleware or onError() to every route schema. It is exported from hono/client from v4.12.1. Use PickResponseByStatusCode in later 4.12 releases to select a status variant. Augment NotFoundResponse when the application has a typed custom 404 body.
parseResponse() accepts an hc response promise, selects a parser from Content-Type, and throws DetailedError for a non-OK response (since 4.9.0).
import { parseResponse } from 'hono/client'
const data = await parseResponse(client.posts.$get())
Use cloneRawRequest(c.req) when middleware or a validator has already consumed the body and the raw Request must be sent elsewhere.
jwt accepts headerName for a nonstandard header and cookie for a named cookie.jwk accepts headerName; keys and jwks_uri may be context-dependent functions.jwk({ allow_anon: true, ... }) allows unauthenticated continuation and leaves jwtPayload unset when no valid token is available.Bearer authorization scheme.Use JwtVariables in the application's Variables type so c.get('jwtPayload') is typed. Configure issuer validation and temporal-claim checks rather than duplicating them in handlers.
Use Basic Auth's async-capable onAuthSuccess(c, username) hook to record identity or audit state after successful authentication, including when using verifyUser.
cacheableStatusCodes.onCacheNotAvailable.Vary headers contribute to cache keys.Vary: Authorization or Vary: Cookie are not cached.private or no-store.cors({ allowMethods }) accepts a function of the request origin. Compression accepts contentTypeFilter; start custom checks from COMPRESSIBLE_CONTENT_TYPE_REGEX. MessagePack is recognized as compressible.
upgradeWebSocket and websocket directly from the Bun adapter.getConnInfo from the AWS Lambda, Cloudflare Pages, or Netlify adapter.http+unix URLs for HTTP over Unix sockets.return streamSSE(c, async (stream) => {
while (!stream.aborted) {
await stream.writeSSE({ event: 'tick', data: 'tick' })
await stream.sleep(1000)
}
})
Producer errors after streaming begins do not reach app.onError(). Supply the streaming helper's third callback to finish or close the existing stream; it cannot replace the response. Under Wrangler, set Content-Encoding: Identity when its streaming behavior requires the workaround.
import { defaultPlugin, redirectPlugin, toSSG } from 'hono/ssg'
await toSSG(app, fs, {
plugins: [redirectPlugin(), defaultPlugin()],
})
Use ssgParams() to enumerate parameterized pages, disableSSG() to exclude a route, onlySSG() for generation-only routes, and isSSGContext(c) for generation-specific output. Node.js accepts a filesystem argument; the Bun and Deno adapter entry points do not.
Give StreamingContext a scriptNonce and allow the same nonce in the response CSP whenever streamed Suspense or ErrorBoundary output may emit inline scripts. CSP configuration also supports report-to and report-uri.
Install @hono/cli for the hono command.
hono search "basic auth"
hono docs /docs/api/routing
hono request -P /api/users -X POST -d '{"name":"Ada"}' src/index.ts
hono serve --use 'logger()' src/index.ts
hono optimize src/index.ts
request runs app.request() in-process. serve starts at http://localhost:7070 and can inject repeated --use middleware. optimize emits a precomputed PreparedRegExpRouter entry at dist/index.js.