new
HonoBase(options?: HonoOptions<E>)
all: HandlerInterface<E, "all", S, BasePath>
delete: HandlerInterface<E, "delete", S, BasePath>
private
errorHandler: ErrorHandler
fire: () => void
.fire()
automatically adds a global fetch event listener.
This can be useful for environments that adhere to the Service Worker API, such as non-ES module Cloudflare Workers.
get: HandlerInterface<E, "get", S, BasePath>
.notFound()
allows you to customize a Not Found Response.
on: OnHandlerInterface<E, S, BasePath>
.onError()
handles an error and returns a customized Response.
options: HandlerInterface<E, "options", S, BasePath>
patch: HandlerInterface<E, "patch", S, BasePath>
post: HandlerInterface<E, "post", S, BasePath>
put: HandlerInterface<E, "put", S, BasePath>
request: (input: RequestInfo | URL,requestInit?: RequestInit,Env?: E["Bindings"] | { },executionCtx?: ExecutionContext,) => Response | Promise<Response>
.request()
is a useful method for testing.
You can pass a URL or pathname to send a GET request.
app will return a Response object.
test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })
router: Router<[H, RouterRoute]>