Skip to content

HttpServerBackend

Defined in: src/http/backend/HttpServerBackend.ts:23

Pluggable HTTP server abstraction. Backends translate our generic route registrations to their native framework (Fastify, Bun.serve, Express, …). The DSL only ever talks to this interface.

readonly name: string

Defined in: src/http/backend/HttpServerBackend.ts:24

listen(host, port): Promise<ServerBinding>

Defined in: src/http/backend/HttpServerBackend.ts:30

Start listening. Returns a ServerBinding with the actual bound port.

string

number

Promise<ServerBinding>


registerRoute(route): void

Defined in: src/http/backend/HttpServerBackend.ts:27

Register all routes before listen is called. Duplicate paths must be rejected.

RouteRegistration

void


optional setErrorHandler(handler): void

Defined in: src/http/backend/HttpServerBackend.ts:36

Optionally register a global error handler.

(err, req) => HttpResponse | Promise<HttpResponse>

void


optional setNotFound(handler): void

Defined in: src/http/backend/HttpServerBackend.ts:33

Optionally register a catch-all not-found handler.

(req) => HttpResponse | Promise<HttpResponse>

void