Creating HttpRouter adapters
HttpRouter relies on the Hono router adapter interface for URL pattern matching and request dispatching. It does not ship with a built-in router. Instead, you supply a Hono Router instance that satisfies the adapter interface.
Implementing your custom Router adapter
In order to create an adapter you need to implement the Router contract from Hono. The interface defines three members:
interface Router<T> {
name: string;
add(method: string, path: string, handler: T): void;
match(method: string, path: string): Result<T>;
}
Further information
For further information refer to:
- Hono GitHub repository: source code for the Hono framework, including the router adapters (
hono/router). - Hono Routing official documentation: guide to Hono's routing system, including path patterns, route grouping, and router selection.