How a request becomes a response
Trace a request through route registration, middleware, routing, and response construction.
honojs/hono · e2740d5
- 1. The Hono class
The public class delegates to HonoBase and supplies the default routers.
src/hono.ts
- 2. HonoBase
Where routes are registered and fetch dispatches a request.
src/hono-base.ts
- 3. The middleware onion
Handlers compose through nested next() calls, with errors and responses handled on return.
src/compose.ts
- 4. Router contract
The interface every router implements.
src/router.ts
- 5. Trie router
Route registration and matching delegate to a trie, expanding optional parameters on insertion.
src/router/trie-router/router.ts
- 6. Trie node
Trie nodes store handlers and match paths through literal, parameter, and wildcard branches.
src/router/trie-router/node.ts
- 7. Smart router
How Hono picks a router at runtime.
src/router/smart-router/router.ts
- 8. Context
What a handler receives and how a response is built.
src/context.ts
- 9. HonoRequest
The request wrapper handlers read from.
src/request.ts
Reading practice record...