Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/hono/hono.ts>Hono

Ultrafast web framework for Cloudflare Workers, Deno, and Bun. Fast, but not only fast.
Extremely Popular
Go to Latest
class Hono
import { Hono } from "https://deno.land/x/hono@v2.5.5/hono.ts";

Constructors

new
Hono(init?: Partial<Pick<Hono, "router" | "strict">>)

Type Parameters

optional
E extends Partial<Environment> = Environment
optional
P extends string = "/"
optional
S extends Partial<Schema> = Schema

Properties

private
_tempPath: string
private
errorHandler: ErrorHandler<E>
private
notFoundHandler: NotFoundHandler<E>
private
path: string
fetch: (
request: Request,
Environment?: E["Bindings"],
executionCtx?: ExecutionContext,
) => unknown
handleEvent: (event: FetchEvent) => unknown
request: (input: Request | string, requestInit?: RequestInit) => unknown
readonly
router: Router<Handler<P, E, S>>
routes: Route<P, E, S>[]
readonly
strict: boolean

Methods

private
addRoute(
method: string,
path: string,
handler: Handler<P, E, S>,
)
private
dispatch(
request: Request,
eventOrExecutionCtx?: ExecutionContext | FetchEvent,
env?: E["Bindings"],
)
private
handleError(err: unknown, c: Context<string, E>)
private
matchRoute(method: string, path: string)
on(
method: string,
path: string,
...handlers: Handler<P, E, S>[],
)
route(path: string, app?: Hono<any>)
use<Path extends string = string, Data extends Partial<Schema> = Schema>(...middleware: Handler<Path, E, Data>[]): Hono<E, P, S>
use<Path extends string = string, Data extends Partial<Schema> = Schema>(arg1: string, ...middleware: Handler<Path, E, Data>[]): Hono<E, P, S>