class DenoHttpAdapter
implements IHttpAdapter

Deno HTTP adapter implementation.

Constructors

DenoHttpAdapter()

Methods

close(handle: ServerHandle): Promise<void>

Stops the server gracefully.

fetch(request: Request): Response | Promise<Response>

The universal web-standard entry point. Accepts a web Request and returns a web Response. May be called without listen (e.g. Cloudflare Workers where export default { fetch: app.fetch } is the deploy path).

listen(
port: number,
hostname?: string
): Promise<ServerHandle>

Binds the adapter's fetch to a real TCP socket.

setHandler(handler: (request: IRequest) => IResponse | Promise<IResponse>): void

Installs the framework request handler. Called once at start() time, after the middleware pipeline compiles and before any fetch or listen.

deprecated
Since 0.3.0
setRpcHandler(handler: RpcFetchHandler): void

Installs a gRPC/Connect fetch handler.

Since 0.2.0
setUpgradeRouter(router: WebSocketUpgradeRouter): void

Installs a WebSocket upgrade router. The adapter stores the router but does not consult it: since M70a the kernel's terminal handler resolves IWebSocketService and calls routeUpgrade itself, after the middleware pipeline has run without short-circuiting and before route matching — so an application catch-all cannot shadow an upgrade. What the adapter needs from this setter is the bare fact that a router was installed: Node attaches its raw upgrade listener only then.

Optional: absent on adapters that cannot perform a WebSocket handshake. Callers MUST degrade gracefully when it is not provided — see the WebSocketPlugin, which still registers its service and health indicator but fails route() with a typed error. Because the member is optional, adapters written before this seam existed remain valid implementations.

Upgrade detection is the router's own job — it returns null for anything that is not an upgrade on a path it owns, and the kernel falls through to normal HTTP handling — so installing a router never changes the behavior of non-WebSocket traffic.

Usage

import { DenoHttpAdapter } from "runtime/src/index.ts";