File contents Routing
[!NOTE]
Your token must match the regex /[A-Za-z0-9._~+/-]+=*/, otherwise a 400 error will be returned. Notably, this regex accommodates both URL-safe Base64- and standard Base64-encoded JWTs. This middleware does not require the bearer token to be a JWT, just that it matches the above regex.
[!NOTE]
Your token must match the regex /[A-Za-z0-9._~+/-]+=*/, otherwise a 400 error will be returned. Notably, this regex accommodates both URL-safe Base64- and standard Base64-encoded JWTs. This middleware does not require the bearer token to be a JWT, just that it matches the above regex.
Available Resources
Quick Start
Features
Use-cases
Who is using Hono?
Hono in 1 minute
Ultrafast
Lightweight
Multiple routers
Web Standards
Middleware & Helpers
Basic Authentication
URL: /docs/middleware/builtin/basic-auth
Bearer Authentication
URL: /docs/middleware/builtin/bearer-auth
Body Limit
URL: /docs/middleware/builtin/body-limit
Cache
URL: /docs/middleware/builtin/cache
Compress
URL: /docs/middleware/builtin/compress
Context Storage
URL: /docs/middleware/builtin/context-storage
Cookie
URL: /docs/helpers/cookie
CORS
URL: /docs/middleware/builtin/cors
ETag
URL: /docs/middleware/builtin/etag
html
JSX
JWT Authentication
URL: /docs/middleware/builtin/jwt
Logger
URL: /docs/middleware/builtin/logger
Language
URL: /docs/middleware/builtin/language
Pretty JSON
URL: /docs/middleware/builtin/pretty-json
Secure Headers
URL: /docs/middleware/builtin/secure-headers
SSG
Streaming
URL: /docs/helpers/streaming
GraphQL Server
Firebase Authentication
Sentry
Developer Experience
Auth.js(Next Auth)
Casbin
Clerk Auth
Cloudflare Access
OAuth Providers
OIDC Auth
Firebase Auth
Verify RSA JWT (JWKS)
SSOJet Auth
Stytch Auth
Shopify Auth
Ajv Validator
ArkType Validator
Class Validator
Conform Validator
Effect Schema Validator
Standard Schema Validator
TypeBox Validator
Typia Validator
unknownutil Validator
Valibot Validator
Zod Validator
Zod OpenAPI
Scalar
Swagger UI
Swagger Editor
Hono OpenAPI
hono-zod-openapi
ESLint Config
hono-testkit
SSG Plugin Essential
Apitally (API monitoring & analytics)
Highlight.io
LogTape (Logging)
OpenTelemetry
Prometheus Metrics
Sentry
Pino logger
GraphQL Server
oRPC
tRPC Server
mcp-use (MCP Server)
Bun Transpiler
esbuild Transpiler
Qwik City
React Compatibility
React Renderer
GlideMQ (Message Queue REST API + SSE)
Intlayer i18n
Bun Compress
Cap Checkpoint
Event Emitter
Geo
Hono Rate Limiter
Hono Problem Details (RFC 9457)
Hono Simple DI
InferDI
Idempotency (Stripe-style idempotency keys)
idempot-js
jsonv-ts (Validator, OpenAPI, MCP)
MCP
RONIN (Database)
Session
StitchAPI (Typed, resilient API calls + SSE)
tsyringe
User Agent based Blocker
Import
Usage
Options
More Options
Recipes
Import
Usage
Options
Import
Usage
Options
Usage with Bun for large requests
Import
Usage
Caching QUERY requests
Options
Import
Usage
Import
Usage
Options
Import
Usage
tryGetContext
Import
Usage
Options
Environment-dependent CORS configuration
Using with Vite
Import
Usage
Options
Link : string : Single allowed origin (e.g., `'
Import
Usage
The retained headers
Options
Import
Usage
Rules
Error handling
Import
Usage
Options
Nested Layouts
useRequestContext()
Extending ContextRenderer
What this middleware validates
Import
Usage
Using verifyWithJwks outside of middleware
Configuring JWKS fetch request options
Options
Import
Usage
Options
Import
Basic Usage
Default Configuration
Key Behaviors
Advanced Configuration
Options Reference
Validation & Error Handling
Common Recipes
Import
Usage
Logging Details
PrintFunc
Options
Import
Usage
Options
Import
Usage
For example
Options
Import
Usage
Options
Import
Usage
Options
Platform specific Request IDs
AWS documentation: Context object
**Cloudflare Ray ID
**
Request ID on the Deno Blog
Fastly documentation: req.xid
Import
Usage
Supported Options
Middleware Conflict
Setting Content-Security-Policy
Setting Permission-Policy
Import
Usage
Notes
Middleware Conflicts
Import
Usage
Result
Options
Import
Usage
Options
Note
Import
accepts()
Options
Import
env()
getRuntimeKey()
Import
Usage
Type Definitions
Import
Usage
Options
__Secure- and __Host- prefix
Following the best practices
Import
css
keyframes
cx
Usage in combination with Secure Headers middleware
createCssContext
Security
Tips
getRouterName()
showRoutes()
Options
Import
createFactory()
createMiddleware()
factory.createHandlers()
factory.createApp()
Import
html
raw()
Tips
Import
sign()
verify()
decode()
Payload Validation
Custom Error Types
Supported AlgorithmTypes
Import
proxy()
Import
Usage
matchedRoutes()
routePath()
baseRoutePath()
basePath()
Usage
toSSG
Generate File
Middleware
Plugins
Import
stream()
streamText()
streamSSE()
Error Handling
Import
testClient()
Import
upgradeWebSocket()
RPC-mode
Examples
Don't make "Controllers" when possible
factory.createHandlers() in hono/factory
Building a larger application
HEAD Request Best Practices
Passing arguments:
Commonly used arguments
Example flows
Troubleshooting & tips
Links & references
Is there an official Renovate config for Hono?
Available Helpers
Accepts
URL: /docs/helpers/accepts
Adapter
URL: /docs/helpers/adapter
Cookie
URL: /docs/helpers/cookie
css
Dev
Factory
URL: /docs/helpers/factory
html
JWT
SSG
Streaming
URL: /docs/helpers/streaming
Testing
URL: /docs/helpers/testing
WebSocket
URL: /docs/helpers/websocket
Counter example
render()
Hooks compatible with React
startViewTransition() family
the finish promise becomes fulfilled
The hono/jsx/dom runtime
Settings
Usage
Metadata hoisting
Fragment
PropsWithChildren
Inserting Raw HTML
Memoization
Context
Async Component
Suspense
ErrorBoundary
StreamingContext
Integration with html Middleware
With JSX Renderer Middleware
Override type definitions
Definition of Middleware
Execution order
Built-in Middleware
Custom Middleware
Context access inside Middleware arguments
Third-party Middleware
Contributing
Sponsoring
Other Resources
Server
Client
Status code
Global Response
Not Found
Path parameters
Headers
init option
$url()
$path()
File Uploads
Custom fetch method
Custom query serializer
Infer
Parsing a Response with type-safety helper
Using SWR
Using RPC with larger applications
Known issues
Request and Response
Env
Manual validator
Multiple validators
With Zod
Zod Validator Middleware
Standard Schema Validator Middleware
1. Setup
2. Hello World
3. Setup serverless-devs
4. Deploy
1. Setup
2. Hello World
3. Deploy
Serve Binary data
Access AWS Lambda Object
Access RequestContext
Lambda response streaming
1. Install CLI
Install the Azure Functions Core Tools | Microsoft Learn
2. Setup
3. Hello World
4. Run
5. Deploy
Starter
Hello World
Return JSON
Request and Response
Return HTML
Return raw Response
Using Middleware
Adapter
Next step
1. Install Bun
2. Setup
3. Hello World
4. Run
Change port number
Serve static files
Testing
1. Setup
2. Hello World
3. Run
4. Bootstrap
5. Deploy
1. Setup
2. Hello World
3. Run
4. Deploy
Bindings
Client-side
Cloudflare Pages Middleware
1. Setup
2. Hello World
3. Run
4. Deploy
Bindings
Client-side
1. Setup
2. Hello World
3. Run
4. Deploy
Using Hono with other event handlers
Serve static files
Types
Testing
Bindings
Using Variables in Middleware
Deploy from GitHub Actions
Load env when local development
1. Install Deno
2. Setup
3. Hello World
4. Run
Change port number
Serve static files
Deno Deploy
Testing
npm and JSR
1. Setup
2. Hello World
3. Run
4. Deploy
Bindings
1. Install the CLI
2. Project setup
3. Hello World
4. Deploy
Changing runtimes
Node.js
URL: /docs/getting-started/nodejs#building-deployment
Bun
Deno
1. Setup
2. Hello World
3. Deploy
Callback
1. Setup
2. Hello World
3. Run
4. Deploy
Context
1. Setup
2. Hello World
3. Run
4. Deploy
Pages Router
1. Setup
2. Hello World
3. Run
Change port number
WebSocket
Access the raw Node.js APIs
Serve static files
http2
Building & Deployment
1. Setup
2. Hello World
3. Run
1. Setup
2. Hello World
3. Run
Link : Make a GET request using cURL or Postman to `
4. Deploy
1. Setup
2. Hello World
3. Run
4. Deploy
Further reading
1. Setup
2. Set up WIT interface & dependencies
3. Hello Wasm
4. Build
5. Run
More information
Routers
Cloudflare Workers
Deno
Bun
SaltyAom/bun-http-framework-benchmark
Motivation
RegExpRouter
TrieRouter
SmartRouter
LinearRouter
PatternRouter
RPC
Zod
Zod Validator Middleware
Writing API
Validation with Zod
Sharing the Types
Client
With React
req
status()
header()
body()
text()
json()
html()
notFound()
redirect()
res
set() / get()
var
render() / setRenderer()
executionCtx
event
env
error
ContextVariableMap
Throwing HTTPExceptions
Handling HTTPExceptions
Methods
Not Found
Error Handling
fire()
fetch()
request()
mount()
strict mode
router option
Generics
hono
hono/quick
hono/tiny
Which preset should I use?
param()
query()
queries()
header()
parseBody()
json()
text()
arrayBuffer()
blob()
formData()
valid()
routePath
matchedRoutes
path
url
method
raw
cloneRawRequest()
Basic
Path Parameter
Regexp
Including slashes
Chained route
Grouping
Grouping without changing base
Base path
Routing with hostname
Routing with host Header value
Routing priority
Grouping ordering
Additional Resources (Optional)
Optional Parameter
How to Use This Skill
Reference these resources when working with Routing.
1 --- 2 name: routing 3 description: [!NOTE] 4 Your `token` must match the regex `/[A-Za-z0-9._~+/-]+=*/`, otherwise a 400 error will be returned. Notably, this regex accommodates both URL-safe Base64- and standard Base64-encoded JWTs. This middleware does not require the bearer token to be a JWT, just that it matches the above regex. 5 metadata: 6 source: https://skillmd.com/skills/hk-vk/routing 7 upstream: llms.txt 8 source_url: https://hono.dev/llms-full.txt 9 generated: 2026-09-23T09:40:35.596Z 10 --- 11 12 # Routing 13 14 > [!NOTE] 15 Your `token` must match the regex `/[A-Za-z0-9._~+/-]+=*/`, otherwise a 400 error will be returned. Notably, this regex accommodates both URL-safe Base64- and standard Base64-encoded JWTs. This middleware does not require the bearer token to be a JWT, just that it matches the above regex. 16 17 [!NOTE] 18 Your `token` must match the regex `/[A-Za-z0-9._~+/-]+=*/`, otherwise a 400 error will be returned. Notably, this regex accommodates both URL-safe Base64- and standard Base64-encoded JWTs. This middleware does not require the bearer token to be a JWT, just that it matches the above regex. 19 20 ## Available Resources 21 22 ### Quick Start 23 24 ### Features 25 26 ### Use-cases 27 28 ### Who is using Hono? 29 30 - **Drivly** 31 - URL: https://driv.ly/ 32 33 - **repeat.dev** 34 - URL: https://repeat.dev/ 35 36 ### Hono in 1 minute 37 38 ### Ultrafast 39 40 ### Lightweight 41 42 ### Multiple routers 43 44 ### Web Standards 45 46 ### Middleware & Helpers 47 48 - **Basic Authentication** 49 - URL: /docs/middleware/builtin/basic-auth 50 51 - **Bearer Authentication** 52 - URL: /docs/middleware/builtin/bearer-auth 53 54 - **Body Limit** 55 - URL: /docs/middleware/builtin/body-limit 56 57 - **Cache** 58 - URL: /docs/middleware/builtin/cache 59 60 - **Compress** 61 - URL: /docs/middleware/builtin/compress 62 63 - **Context Storage** 64 - URL: /docs/middleware/builtin/context-storage 65 66 - **Cookie** 67 - URL: /docs/helpers/cookie 68 69 - **CORS** 70 - URL: /docs/middleware/builtin/cors 71 72 - **ETag** 73 - URL: /docs/middleware/builtin/etag 74 75 - **html** 76 - URL: /docs/helpers/html 77 78 - **JSX** 79 - URL: /docs/guides/jsx 80 81 - **JWT Authentication** 82 - URL: /docs/middleware/builtin/jwt 83 84 - **Logger** 85 - URL: /docs/middleware/builtin/logger 86 87 - **Language** 88 - URL: /docs/middleware/builtin/language 89 90 - **Pretty JSON** 91 - URL: /docs/middleware/builtin/pretty-json 92 93 - **Secure Headers** 94 - URL: /docs/middleware/builtin/secure-headers 95 96 - **SSG** 97 - URL: /docs/helpers/ssg 98 99 - **Streaming** 100 - URL: /docs/helpers/streaming 101 102 - **GraphQL Server** 103 - URL: https://github.com/honojs/middleware/tree/main/packages/graphql-server 104 105 - **Firebase Authentication** 106 - URL: https://github.com/honojs/middleware/tree/main/packages/firebase-auth 107 108 - **Sentry** 109 - URL: https://github.com/honojs/middleware/tree/main/packages/sentry 110 111 ### Developer Experience 112 113 - **Auth.js(Next Auth)** 114 - URL: https://github.com/honojs/middleware/tree/main/packages/auth-js 115 116 - **Casbin** 117 - URL: https://github.com/honojs/middleware/tree/main/packages/casbin 118 119 - **Clerk Auth** 120 - URL: https://github.com/honojs/middleware/tree/main/packages/clerk-auth 121 122 - **Cloudflare Access** 123 - URL: https://github.com/honojs/middleware/tree/main/packages/cloudflare-access 124 125 - **OAuth Providers** 126 - URL: https://github.com/honojs/middleware/tree/main/packages/oauth-providers 127 128 - **OIDC Auth** 129 - URL: https://github.com/honojs/middleware/tree/main/packages/oidc-auth 130 131 - **Firebase Auth** 132 - URL: https://github.com/honojs/middleware/tree/main/packages/firebase-auth 133 134 - **Verify RSA JWT (JWKS)** 135 - URL: https://github.com/wataruoguchi/verify-rsa-jwt-cloudflare-worker 136 137 - **SSOJet Auth** 138 - URL: https://github.com/ssojet/ssojet-hono 139 140 - **Stytch Auth** 141 - URL: https://github.com/honojs/middleware/tree/main/packages/stytch-auth 142 143 - **Shopify Auth** 144 - URL: https://github.com/besart-k/hono-shopify-auth 145 146 - **Ajv Validator** 147 - URL: https://github.com/honojs/middleware/tree/main/packages/ajv-validator 148 149 - **ArkType Validator** 150 - URL: https://github.com/honojs/middleware/tree/main/packages/arktype-validator 151 152 - **Class Validator** 153 - URL: https://github.com/honojs/middleware/tree/main/packages/class-validator 154 155 - **Conform Validator** 156 - URL: https://github.com/honojs/middleware/tree/main/packages/conform-validator 157 158 - **Effect Schema Validator** 159 - URL: https://github.com/honojs/middleware/tree/main/packages/effect-validator 160 161 - **Standard Schema Validator** 162 - URL: https://github.com/honojs/middleware/tree/main/packages/standard-validator 163 164 - **TypeBox Validator** 165 - URL: https://github.com/honojs/middleware/tree/main/packages/typebox-validator 166 167 - **Typia Validator** 168 - URL: https://github.com/honojs/middleware/tree/main/packages/typia-validator 169 170 - **unknownutil Validator** 171 - URL: https://github.com/ryoppippi/hono-unknownutil-validator 172 173 - **Valibot Validator** 174 - URL: https://github.com/honojs/middleware/tree/main/packages/valibot-validator 175 176 - **Zod Validator** 177 - URL: https://github.com/honojs/middleware/tree/main/packages/zod-validator 178 179 - **Zod OpenAPI** 180 - URL: https://github.com/honojs/middleware/tree/main/packages/zod-openapi 181 182 - **Scalar** 183 - URL: https://github.com/scalar/scalar/tree/main/integrations/hono 184 185 - **Swagger UI** 186 - URL: https://github.com/honojs/middleware/tree/main/packages/swagger-ui 187 188 - **Swagger Editor** 189 - URL: https://github.com/honojs/middleware/tree/main/packages/swagger-editor 190 191 - **Hono OpenAPI** 192 - URL: https://github.com/rhinobase/hono-openapi 193 194 - **hono-zod-openapi** 195 - URL: https://github.com/paolostyle/hono-zod-openapi 196 197 - **ESLint Config** 198 - URL: https://github.com/honojs/middleware/tree/main/packages/eslint-config 199 200 - **hono-testkit** 201 - URL: https://github.com/md-sagban/hono-testkit 202 203 - **SSG Plugin Essential** 204 - URL: https://github.com/honojs/middleware/tree/main/packages/ssg-plugins-essential 205 206 - **Apitally (API monitoring & analytics)** 207 - URL: https://docs.apitally.io/frameworks/hono 208 209 - **Highlight.io** 210 - URL: https://www.highlight.io/docs/getting-started/backend-sdk/js/hono 211 212 - **LogTape (Logging)** 213 - URL: https://logtape.org/manual/integrations#hono 214 215 - **OpenTelemetry** 216 - URL: https://github.com/honojs/middleware/tree/main/packages/otel 217 218 - **Prometheus Metrics** 219 - URL: https://github.com/honojs/middleware/tree/main/packages/prometheus 220 221 - **Sentry** 222 - URL: https://github.com/honojs/middleware/tree/main/packages/sentry 223 224 - **Pino logger** 225 - URL: https://github.com/maou-shonen/hono-pino 226 227 - **GraphQL Server** 228 - URL: https://github.com/honojs/middleware/tree/main/packages/graphql-server 229 230 - **oRPC** 231 - URL: https://orpc.dev/docs/adapters/hono 232 233 - **tRPC Server** 234 - URL: https://github.com/honojs/middleware/tree/main/packages/trpc-server 235 236 - **mcp-use (MCP Server)** 237 - URL: https://github.com/mcp-use/mcp-use 238 239 - **Bun Transpiler** 240 - URL: https://github.com/honojs/middleware/tree/main/packages/bun-transpiler 241 242 - **esbuild Transpiler** 243 - URL: https://github.com/honojs/middleware/tree/main/packages/esbuild-transpiler 244 245 - **Qwik City** 246 - URL: https://github.com/honojs/middleware/tree/main/packages/qwik-city 247 248 - **React Compatibility** 249 - URL: https://github.com/honojs/middleware/tree/main/packages/react-compat 250 251 - **React Renderer** 252 - URL: https://github.com/honojs/middleware/tree/main/packages/react-renderer 253 254 - **GlideMQ (Message Queue REST API + SSE)** 255 - URL: https://github.com/avifenesh/glidemq-hono 256 257 - **Intlayer i18n** 258 - URL: https://intlayer.org/doc/environment/hono 259 260 - **Bun Compress** 261 - URL: https://github.com/honojs/middleware/tree/main/packages/bun-compress 262 263 - **Cap Checkpoint** 264 - URL: https://capjs.js.org/guide/middleware/hono.html 265 266 - **Event Emitter** 267 - URL: https://github.com/honojs/middleware/tree/main/packages/event-emitter 268 269 - **Geo** 270 - URL: https://github.com/ktkongtong/hono-geo-middleware/tree/main/packages/middleware 271 272 - **Hono Rate Limiter** 273 - URL: https://github.com/rhinobase/hono-rate-limiter 274 275 - **Hono Problem Details (RFC 9457)** 276 - URL: https://github.com/paveg/hono-problem-details 277 278 - **Hono Simple DI** 279 - URL: https://github.com/maou-shonen/hono-simple-DI 280 281 - **InferDI** 282 - URL: https://github.com/inferdi/inferdi/tree/main/packages/hono 283 284 - **Idempotency (Stripe-style idempotency keys)** 285 - URL: https://github.com/paveg/hono-idempotency 286 287 - **idempot-js** 288 - URL: https://js.idempot.dev 289 290 - **jsonv-ts (Validator, OpenAPI, MCP)** 291 - URL: https://github.com/dswbx/jsonv-ts 292 293 - **MCP** 294 - URL: https://github.com/honojs/middleware/tree/main/packages/mcp 295 296 - **RONIN (Database)** 297 - URL: https://github.com/ronin-co/hono-client 298 299 - **Session** 300 - URL: https://github.com/honojs/middleware/tree/main/packages/session 301 302 - **StitchAPI (Typed, resilient API calls + SSE)** 303 - URL: https://github.com/rejifald/StitchAPI/tree/main/packages/hono 304 305 - **tsyringe** 306 - URL: https://github.com/honojs/middleware/tree/main/packages/tsyringe 307 308 - **User Agent based Blocker** 309 - URL: https://github.com/honojs/middleware/tree/main/packages/ua-blocker 310 311 ### Import 312 313 ### Usage 314 315 ### Options 316 317 ### More Options 318 319 ### Recipes 320 321 ### Import 322 323 ### Usage 324 325 ### Options 326 327 ### Import 328 329 ### Usage 330 331 ### Options 332 333 ### Usage with Bun for large requests 334 335 ### Import 336 337 ### Usage 338 339 ### Caching QUERY requests 340 341 ### Options 342 343 ### Import 344 345 ### Usage 346 347 ### Import 348 349 ### Usage 350 351 ### Options 352 353 ### Import 354 355 ### Usage 356 357 ### tryGetContext 358 359 ### Import 360 361 ### Usage 362 363 ### Options 364 365 ### Environment-dependent CORS configuration 366 367 ### Using with Vite 368 369 ### Import 370 371 ### Usage 372 373 ### Options 374 375 - **Link**: **`string`**: Single allowed origin (e.g., `' 376 - URL: https://example.com'`) 377 378 ### Import 379 380 ### Usage 381 382 ### The retained headers 383 384 ### Options 385 386 ### Import 387 388 ### Usage 389 390 ### Rules 391 392 ### Error handling 393 394 ### Import 395 396 ### Usage 397 398 ### Options 399 400 ### Nested Layouts 401 402 ### `useRequestContext()` 403 404 ### Extending `ContextRenderer` 405 406 ### What this middleware validates 407 408 ### Import 409 410 ### Usage 411 412 ### Using `verifyWithJwks` outside of middleware 413 414 ### Configuring JWKS fetch request options 415 416 ### Options 417 418 ### Import 419 420 ### Usage 421 422 ### Options 423 424 ### Import 425 426 ### Basic Usage 427 428 ### Default Configuration 429 430 ### Key Behaviors 431 432 ### Advanced Configuration 433 434 ### Options Reference 435 436 ### Validation & Error Handling 437 438 ### Common Recipes 439 440 ### Import 441 442 ### Usage 443 444 ### Logging Details 445 446 ### PrintFunc 447 448 ### Options 449 450 ### Import 451 452 ### Usage 453 454 ### Options 455 456 ### Import 457 458 ### Usage 459 460 ### For example 461 462 ### Options 463 464 ### Import 465 466 ### Usage 467 468 ### Options 469 470 ### Import 471 472 ### Usage 473 474 ### Options 475 476 ### Platform specific Request IDs 477 478 - **AWS documentation: Context object** 479 - URL: https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html 480 481 - **Cloudflare Ray ID 482 ** 483 - URL: https://developers.cloudflare.com/fundamentals/reference/cloudflare-ray-id/ 484 485 - **Request ID on the Deno Blog** 486 - URL: https://deno.com/blog/zero-config-debugging-deno-opentelemetry#:~:text=s%20automatically%20have-,unique%20request%20IDs,-associated%20with%20them 487 488 - **Fastly documentation: req.xid** 489 - URL: https://www.fastly.com/documentation/reference/vcl/variables/client-request/req-xid/ 490 491 ### Import 492 493 ### Usage 494 495 ### Supported Options 496 497 ### Middleware Conflict 498 499 ### Setting Content-Security-Policy 500 501 ### Setting Permission-Policy 502 503 ### Import 504 505 ### Usage 506 507 ### Notes 508 509 ### Middleware Conflicts 510 511 ### Import 512 513 ### Usage 514 515 ### Result 516 517 ### Options 518 519 ### Import 520 521 ### Usage 522 523 ### Options 524 525 ### Note 526 527 ### Import 528 529 ### `accepts()` 530 531 ### Options 532 533 ### Import 534 535 ### `env()` 536 537 - **`Deno.env`** 538 - URL: https://docs.deno.com/runtime/manual/basics/env_variables 539 540 - **`Bun.env`** 541 - URL: https://bun.com/guides/runtime/set-env 542 543 - **Environment Variables on Vercel** 544 - URL: https://vercel.com/docs/projects/environment-variables 545 546 - **Environment Variables on AWS Lambda** 547 - URL: https://docs.aws.amazon.com/lambda/latest/dg/samples-blank.html#samples-blank-architecture 548 549 - **not supported** 550 - URL: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/add-origin-custom-headers.html 551 552 - **Netlify Contexts** 553 - URL: https://docs.netlify.com/site-deploys/overview/#deploy-contexts 554 555 ### `getRuntimeKey()` 556 557 ### Import 558 559 ### Usage 560 561 ### Type Definitions 562 563 ### Import 564 565 ### Usage 566 567 ### Options 568 569 ### `__Secure-` and `__Host-` prefix 570 571 ### Following the best practices 572 573 - **RFC6265bis-13** 574 - URL: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-13 575 576 - **CHIPS-01** 577 - URL: https://www.ietf.org/archive/id/draft-cutler-httpbis-partitioned-cookies-01.html 578 579 ### Import 580 581 ### `css` <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 582 583 ### `keyframes` <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 584 585 ### `cx` <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 586 587 ### Usage in combination with [Secure Headers](/docs/middleware/builtin/secure-headers) middleware 588 589 ### `createCssContext` <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 590 591 ### Security 592 593 ### Tips 594 595 ### `getRouterName()` 596 597 ### `showRoutes()` 598 599 ### Options 600 601 ### Import 602 603 ### `createFactory()` 604 605 ### `createMiddleware()` 606 607 ### `factory.createHandlers()` 608 609 ### `factory.createApp()` 610 611 ### Import 612 613 ### `html` 614 615 ### `raw()` 616 617 ### Tips 618 619 - **Link**: < 620 - URL: https://marketplace.visualstudio.com/items?itemName=bierner.lit-html> 621 622 - **Link**: < 623 - URL: https://github.com/MaxMEllon/vim-jsx-pretty> 624 625 ### Import 626 627 ### `sign()` 628 629 ### `verify()` 630 631 ### `decode()` 632 633 ### Payload Validation 634 635 ### Custom Error Types 636 637 ### Supported AlgorithmTypes 638 639 ### Import 640 641 ### `proxy()` 642 643 ### Import 644 645 ### Usage 646 647 ### `matchedRoutes()` 648 649 ### `routePath()` 650 651 ### `baseRoutePath()` 652 653 ### `basePath()` 654 655 ### Usage 656 657 ### toSSG 658 659 ### Generate File 660 661 ### Middleware 662 663 ### Plugins 664 665 ### Import 666 667 ### `stream()` 668 669 ### `streamText()` 670 671 ### `streamSSE()` 672 673 ### Error Handling 674 675 ### Import 676 677 ### `testClient()` 678 679 ### Import 680 681 ### `upgradeWebSocket()` 682 683 ### RPC-mode 684 685 ### Examples 686 687 ### Don't make "Controllers" when possible 688 689 ### `factory.createHandlers()` in `hono/factory` 690 691 ### Building a larger application 692 693 ### HEAD Request Best Practices 694 695 ### Passing arguments: 696 697 ### Commonly used arguments 698 699 ### Example flows 700 701 ### Troubleshooting & tips 702 703 ### Links & references 704 705 - **create-hono** 706 - URL: https://github.com/honojs/create-hono 707 708 ### Is there an official Renovate config for Hono? 709 710 ### Available Helpers 711 712 - **Accepts** 713 - URL: /docs/helpers/accepts 714 715 - **Adapter** 716 - URL: /docs/helpers/adapter 717 718 - **Cookie** 719 - URL: /docs/helpers/cookie 720 721 - **css** 722 - URL: /docs/helpers/css 723 724 - **Dev** 725 - URL: /docs/helpers/dev 726 727 - **Factory** 728 - URL: /docs/helpers/factory 729 730 - **html** 731 - URL: /docs/helpers/html 732 733 - **JWT** 734 - URL: /docs/helpers/jwt 735 736 - **SSG** 737 - URL: /docs/helpers/ssg 738 739 - **Streaming** 740 - URL: /docs/helpers/streaming 741 742 - **Testing** 743 - URL: /docs/helpers/testing 744 745 - **WebSocket** 746 - URL: /docs/helpers/websocket 747 748 ### Counter example 749 750 ### `render()` 751 752 ### Hooks compatible with React 753 754 ### `startViewTransition()` family 755 756 - **the `finish` promise becomes fulfilled** 757 - URL: https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/finished 758 759 ### The `hono/jsx/dom` runtime 760 761 ### Settings 762 763 ### Usage 764 765 ### Metadata hoisting 766 767 ### Fragment 768 769 ### `PropsWithChildren` 770 771 ### Inserting Raw HTML 772 773 ### Memoization 774 775 ### Context 776 777 ### Async Component 778 779 ### Suspense <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 780 781 ### ErrorBoundary <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 782 783 ### StreamingContext <Badge style="vertical-align: middle;" type="warning" text="Experimental" /> 784 785 ### Integration with html Middleware 786 787 ### With JSX Renderer Middleware 788 789 ### Override type definitions 790 791 ### Definition of Middleware 792 793 ### Execution order 794 795 ### Built-in Middleware 796 797 ### Custom Middleware 798 799 ### Context access inside Middleware arguments 800 801 ### Third-party Middleware 802 803 ### Contributing 804 805 ### Sponsoring 806 807 - **Sponsor @yusukebe on GitHub Sponsors** 808 - URL: https://github.com/sponsors/yusukebe 809 810 - **Sponsor @usualoma on GitHub Sponsors** 811 - URL: https://github.com/sponsors/usualoma 812 813 ### Other Resources 814 815 - **Link**: GitHub repository: <a href=" 816 - URL: https://github.com/honojs">https://github.com/honojs</a> 817 818 - **Link**: npm registry: <a href=" 819 - URL: https://www.npmjs.com/package/hono">https://www.npmjs.com/package/hono</a> 820 821 - **Link**: JSR: <a href=" 822 - URL: https://jsr.io/@hono/hono">https://jsr.io/@hono/hono</a> 823 824 ### Server 825 826 ### Client 827 828 ### Status code 829 830 ### Global Response 831 832 ### Not Found 833 834 ### Path parameters 835 836 ### Headers 837 838 ### `init` option 839 840 ### `$url()` 841 842 ### `$path()` 843 844 ### File Uploads 845 846 ### Custom `fetch` method 847 848 ### Custom query serializer 849 850 ### Infer 851 852 ### Parsing a Response with type-safety helper 853 854 ### Using SWR 855 856 ### Using RPC with larger applications 857 858 ### Known issues 859 860 ### Request and Response 861 862 ### Env 863 864 ### Manual validator 865 866 ### Multiple validators 867 868 ### With Zod 869 870 ### Zod Validator Middleware 871 872 ### Standard Schema Validator Middleware 873 874 ### 1. Setup 875 876 ### 2. Hello World 877 878 ### 3. Setup serverless-devs 879 880 ### 4. Deploy 881 882 ### 1. Setup 883 884 ### 2. Hello World 885 886 ### 3. Deploy 887 888 ### Serve Binary data 889 890 ### Access AWS Lambda Object 891 892 ### Access RequestContext 893 894 ### Lambda response streaming 895 896 ### 1. Install CLI 897 898 - **Install the Azure Functions Core Tools | Microsoft Learn** 899 - URL: https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-typescript?pivots=nodejs-model-v4#install-the-azure-functions-core-tools 900 901 ### 2. Setup 902 903 ### 3. Hello World 904 905 ### 4. Run 906 907 ### 5. Deploy 908 909 ### Starter 910 911 ### Hello World 912 913 ### Return JSON 914 915 ### Request and Response 916 917 ### Return HTML 918 919 ### Return raw Response 920 921 ### Using Middleware 922 923 ### Adapter 924 925 ### Next step 926 927 ### 1. Install Bun 928 929 ### 2. Setup 930 931 ### 3. Hello World 932 933 ### 4. Run 934 935 ### Change port number 936 937 ### Serve static files 938 939 ### Testing 940 941 ### 1. Setup 942 943 ### 2. Hello World 944 945 ### 3. Run 946 947 ### 4. Bootstrap 948 949 ### 5. Deploy 950 951 ### 1. Setup 952 953 ### 2. Hello World 954 955 ### 3. Run 956 957 ### 4. Deploy 958 959 - **Cloudflare dashboard** 960 - URL: https://dash.cloudflare.com 961 962 ### Bindings 963 964 ### Client-side 965 966 ### Cloudflare Pages Middleware 967 968 ### 1. Setup 969 970 ### 2. Hello World 971 972 ### 3. Run 973 974 ### 4. Deploy 975 976 ### Bindings 977 978 ### Client-side 979 980 ### 1. Setup 981 982 ### 2. Hello World 983 984 ### 3. Run 985 986 ### 4. Deploy 987 988 ### Using Hono with other event handlers 989 990 ### Serve static files 991 992 ### Types 993 994 ### Testing 995 996 ### Bindings 997 998 ### Using Variables in Middleware 999 1000 ### Deploy from GitHub Actions 1001 1002 ### Load env when local development 1003 1004 ### 1. Install Deno 1005 1006 ### 2. Setup 1007 1008 ### 3. Hello World 1009 1010 ### 4. Run 1011 1012 ### Change port number 1013 1014 ### Serve static files 1015 1016 ### Deno Deploy 1017 1018 ### Testing 1019 1020 ### npm and JSR 1021 1022 ### 1. Setup 1023 1024 ### 2. Hello World 1025 1026 ### 3. Run 1027 1028 ### 4. Deploy 1029 1030 ### Bindings 1031 1032 ### 1. Install the CLI 1033 1034 ### 2. Project setup 1035 1036 ### 3. Hello World 1037 1038 ### 4. Deploy 1039 1040 ### Changing runtimes 1041 1042 - **Node.js** 1043 - URL: /docs/getting-started/nodejs#building-deployment 1044 1045 - **Bun** 1046 - URL: https://bun.com/guides/ecosystem/docker 1047 1048 - **Deno** 1049 - URL: https://docs.deno.com/examples/google_cloud_run_tutorial 1050 1051 ### 1. Setup 1052 1053 ### 2. Hello World 1054 1055 ### 3. Deploy 1056 1057 ### Callback 1058 1059 ### 1. Setup 1060 1061 ### 2. Hello World 1062 1063 ### 3. Run 1064 1065 ### 4. Deploy 1066 1067 ### `Context` 1068 1069 ### 1. Setup 1070 1071 ### 2. Hello World 1072 1073 ### 3. Run 1074 1075 ### 4. Deploy 1076 1077 ### Pages Router 1078 1079 ### 1. Setup 1080 1081 ### 2. Hello World 1082 1083 ### 3. Run 1084 1085 ### Change port number 1086 1087 ### WebSocket 1088 1089 ### Access the raw Node.js APIs 1090 1091 ### Serve static files 1092 1093 ### http2 1094 1095 ### Building & Deployment 1096 1097 ### 1. Setup 1098 1099 ### 2. Hello World 1100 1101 ### 3. Run 1102 1103 ### 1. Setup 1104 1105 ### 2. Hello World 1106 1107 ### 3. Run 1108 1109 - **Link**: Make a GET request using cURL or Postman to ` 1110 - URL: http://127.0.0.1:54321/functions/v1/hello-world/hello`: 1111 1112 ### 4. Deploy 1113 1114 ### 1. Setup 1115 1116 ### 2. Hello World 1117 1118 ### 3. Run 1119 1120 ### 4. Deploy 1121 1122 ### Further reading 1123 1124 ### 1. Setup 1125 1126 ### 2. Set up WIT interface & dependencies 1127 1128 ### 3. Hello Wasm 1129 1130 ### 4. Build 1131 1132 ### 5. Run 1133 1134 ### More information 1135 1136 - **Bytecode Alliance Zulip** 1137 - URL: https://bytecodealliance.zulipchat.com 1138 1139 - **Jco repository** 1140 - URL: https://github.com/bytecodealliance/jco 1141 1142 - **componentize-js repository** 1143 - URL: https://github.com/bytecodealliance/componentize-js 1144 1145 ### Routers 1146 1147 ### Cloudflare Workers 1148 1149 - **benchmarks/handle-event** 1150 - URL: https://github.com/honojs/hono/tree/main/benchmarks/handle-event 1151 1152 ### Deno 1153 1154 - **benchmarks/deno** 1155 - URL: https://github.com/honojs/hono/tree/main/benchmarks/deno 1156 1157 - **Link**: Method: `bombardier --fasthttp -d 10s -c 100 ' 1158 - URL: http://localhost:8000/user/lookup/username/foo'` 1159 1160 ### Bun 1161 1162 - **SaltyAom/bun-http-framework-benchmark** 1163 - URL: https://github.com/SaltyAom/bun-http-framework-benchmark 1164 1165 ### Motivation 1166 1167 ### RegExpRouter 1168 1169 ### TrieRouter 1170 1171 ### SmartRouter 1172 1173 ### LinearRouter 1174 1175 ### PatternRouter 1176 1177 ### RPC 1178 1179 - **Zod** 1180 - URL: https://zod.dev 1181 1182 - **Zod Validator Middleware** 1183 - URL: https://github.com/honojs/middleware/tree/main/packages/zod-validator 1184 1185 ### Writing API 1186 1187 ### Validation with Zod 1188 1189 ### Sharing the Types 1190 1191 ### Client 1192 1193 ### With React 1194 1195 ### req 1196 1197 ### status() 1198 1199 ### header() 1200 1201 ### body() 1202 1203 ### text() 1204 1205 ### json() 1206 1207 ### html() 1208 1209 ### notFound() 1210 1211 ### redirect() 1212 1213 ### res 1214 1215 ### set() / get() 1216 1217 ### var 1218 1219 ### render() / setRenderer() 1220 1221 ### executionCtx 1222 1223 ### event 1224 1225 ### env 1226 1227 ### error 1228 1229 ### ContextVariableMap 1230 1231 ### Throwing HTTPExceptions 1232 1233 ### Handling HTTPExceptions 1234 1235 ### Methods 1236 1237 ### Not Found 1238 1239 ### Error Handling 1240 1241 ### fire() 1242 1243 ### fetch() 1244 1245 ### request() 1246 1247 ### mount() 1248 1249 ### strict mode 1250 1251 ### router option 1252 1253 ### Generics 1254 1255 ### `hono` 1256 1257 ### `hono/quick` 1258 1259 ### `hono/tiny` 1260 1261 ### Which preset should I use? 1262 1263 ### param() 1264 1265 ### query() 1266 1267 ### queries() 1268 1269 ### header() 1270 1271 ### parseBody() 1272 1273 ### json() 1274 1275 ### text() 1276 1277 ### arrayBuffer() 1278 1279 ### blob() 1280 1281 ### formData() 1282 1283 ### valid() 1284 1285 ### routePath 1286 1287 ### matchedRoutes 1288 1289 ### path 1290 1291 ### url 1292 1293 ### method 1294 1295 ### raw 1296 1297 ### cloneRawRequest() 1298 1299 ### Basic 1300 1301 ### Path Parameter 1302 1303 ### Regexp 1304 1305 ### Including slashes 1306 1307 ### Chained route 1308 1309 ### Grouping 1310 1311 ### Grouping without changing base 1312 1313 ### Base path 1314 1315 ### Routing with hostname 1316 1317 ### Routing with `host` Header value 1318 1319 ### Routing priority 1320 1321 ### Grouping ordering 1322 1323 ## Additional Resources (Optional) 1324 1325 ### Optional Parameter 1326 1327 ## How to Use This Skill 1328 1329 Reference these resources when working with Routing.
hk-vk/skills commit c8e61d8f2b
Frequently asked questions How do I install the Routing skill? Run npx get-skill add hk-vk/routing in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Routing skill do? Routing It is listed under Coding & Dev Tools on SkillMD.
Is Routing safe to use? This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. Capability flags: makes network calls, reads secrets. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Routing? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Routing free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Routing? hk-vk (@hk-vk) published this skill. Their other Agent Skills are listed on their SkillMD profile.