Skip to main content
Module

x/hono/mod.ts>Hono

Ultrafast web framework for Cloudflare Workers, Deno, and Bun. Fast, but not only fast.
Extremely Popular
Go to Latest
class Hono
Re-export
import { Hono } from "https://deno.land/x/hono@v2.4.0/mod.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<P, E, S>
private
notFoundHandler: NotFoundHandler<P, E, S>
private
path: string
fetch: (
request: Request,
Environment?: E["Bindings"],
executionCtx?: ExecutionContext,
) => unknown
handleEvent: (event: FetchEvent) => unknown
request: (input: RequestInfo, 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<P, E, S>)
private
matchRoute(method: string, path: string)
notFound(handler: NotFoundHandler<P, E, S>)
onError(handler: ErrorHandler<P, E, S>)
route(path: string, app?: Hono<E, P, S>)
use<Path extends string = string, Data extends Partial<Schema> = Schema>(...middleware: Handler<Path, E, Data>[]): Hono<E, Path, S>
use<Path extends string = string, Data extends Partial<Schema> = Schema>(arg1: string, ...middleware: Handler<Path, E, Data>[]): Hono<E, Path, S>