Skip to content

Choose an HTTP adapter ​

A linker registers CHO's compiled routes with a router. Choose it at ChoWeb.create, based on the environment that will receive requests and the native integrations the application needs.

Compare the adapters ​

Use caseLinkerWhere to serve
A Fetch-based service on a host with URLPatternBuilt-in ChoLinkerserve(app.handler) or a worker's fetch entry point
Hono middleware, worker bindings or a host without URLPatternHonoLinkerserve(app.handler) or a worker's fetch entry point
A Node.js service using Fastify plugins and hooksFastifyLinkerapp.linked.instance.listen(...)

Behavior ​

The linker receives each route with its full path and method. CHO already handles DI, argument evaluation, validation, response conversion and route-level errors. The router decides which route matches and what to send when none does.

BehaviorBuilt-inHonoFastify
Competing static and parameterized pathsFirst declaredFirst declaredStatic path first
Native contextundefinedHono ContextFastify request and reply
Customize a missnotFound optionhono.notFoundsetNotFoundHandler
In-memory request testingapp.handlerapp.handlerapp.handler or inject
Stream over the networkFetch handlerFetch handlerNative Fastify listener
Register routes with app.mountAlso accepts mounts after a requestBefore the first requestBefore ready(), listen() or the first injected request

On all three adapters, put literal routes before parameter routes and use Web APIs in controllers when you want to keep a choice of host. Built-in router · Hono · Fastify · Implement a linker

Released under the MIT License.