///
import type { Context } from './context';
import type { Router } from './router';
export interface ContextVariableMap {
}
declare type Env = Record;
export declare type Handler = (c: Context, next: Next) => Response | Promise | Promise | Promise;
export declare type NotFoundHandler = (c: Context) => Response | Promise;
export declare type ErrorHandler = (err: Error, c: Context) => Response;
export declare type Next = () => Promise;
declare type ParamKeyName = NameWithPattern extends `${infer Name}{${infer _Pattern}` ? Name : NameWithPattern;
declare type ParamKey = Component extends `:${infer NameWithPattern}` ? ParamKeyName : never;
declare type ParamKeys = Path extends `${infer Component}/${infer Rest}` ? ParamKey | ParamKeys : ParamKey;
interface HandlerInterface> {
(path: Path, ...handlers: Handler extends never ? string : ParamKeys, E>[]): U;
(path: string, ...handlers: Handler[]): U;
(...handlers: Handler extends never ? string : ParamKeys, E>[]): U;
(...handlers: Handler[]): U;
}
interface Route {
path: string;
method: string;
handler: Handler;
}
declare const Hono_base: new () => {
all: HandlerInterface;
get: HandlerInterface;
post: HandlerInterface;
put: HandlerInterface;
delete: HandlerInterface;
head: HandlerInterface;
options: HandlerInterface;
patch: HandlerInterface;
};
export declare class Hono extends Hono_base> {
readonly router: Router>;
readonly strict: boolean;
private _tempPath;
private path;
routes: Route[];
constructor(init?: Partial>);
private notFoundHandler;
private errorHandler;
route(path: string, app?: Hono): Hono;
use(path: string, ...middleware: Handler[]): Hono;
use(...middleware: Handler[]): Hono;
onError(handler: ErrorHandler): Hono;
notFound(handler: NotFoundHandler): Hono;
private addRoute;
private matchRoute;
private dispatch;
handleEvent(event: FetchEvent): Promise;
fetch: (request: Request, env?: E, executionCtx?: ExecutionContext) => Promise;
request(input: RequestInfo, requestInit?: RequestInit): Promise;
}
export {};