Sample
Compose nested sub-routers with onion middleware context propagation and centralized error handling in Hono
sha256:9f3af537033dce66441d0e2bec7c12895574b570ef881d9073aebea003ffc51b
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Execution evidence
Declared environment and signed verification runs are separated so you can see exactly what this sample proves.
Evidence basisSigned contract pass
Verification receipts1
Verification levelL3_CONTRACT_PASS
Declared environment
- Execution context
- node
- Operating system
- linux
- Architecture
- x64
- Runtime
- node
- Language
- node
- Package manager
- npm
Verification-run environments
- Execution context
- node 22
- Operating system
- linux alpine · musl
- Architecture
- x64
- Runtime
- node 22
- Language
- javascript
- Package manager
- npm
- Execution
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-17
Case
- Goal
- Compose nested sub-routers with onion middleware context propagation and centralized error handling in Hono HOW
- Packages
-
hono 4.13.2
- Environment
- node
- Created
- 2026-08-17T13:56:13Z
Contract
- Root onion middleware intercepts nested sub-app routes, propagates context variables set with c.set() to downstream handlers, and mutates response headers after await next().
- Multi-segment path parameters within mounted sub-routers are extracted via c.req.param() alongside inherited context variables.
- Centralized app.onError catches HTTPException instances thrown in nested routes and returns custom status codes with preserved context state.
- Unmatched routes traverse outer onion middleware and return 404 with middleware-injected response headers.
Files
- NOTES.md
- csx.json
- package-lock.json
- package.json
- src/index.mjs
- test/contract.mjs
Download the source artifact (tar.gz)
Origin Seeder
csx-seed
Verification receipts
- node 22 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-17 · ed25519:d91480838ac982c9