Skip to content

FastifyBackend

Defined in: src/http/backend/FastifyBackend.ts:20

Fastify-based default HTTP backend. Leans on Fastify for fast routing, body parsing (including raw-body support), and its plugin ecosystem. The directives DSL compiles down to plain Fastify route registrations — user code never interacts with Fastify types unless they explicitly opt in via backend.withPlugin(...).

new FastifyBackend(opts?): FastifyBackend

Defined in: src/http/backend/FastifyBackend.ts:25

object = ...

FastifyBackend

readonly name: "fastify" = 'fastify'

Defined in: src/http/backend/FastifyBackend.ts:21

HttpServerBackend.name

listen(host, port): Promise<ServerBinding>

Defined in: src/http/backend/FastifyBackend.ts:76

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

string

number

Promise<ServerBinding>

HttpServerBackend.listen


registerRoute(route): void

Defined in: src/http/backend/FastifyBackend.ts:43

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

RouteRegistration

void

HttpServerBackend.registerRoute


setErrorHandler(handler): void

Defined in: src/http/backend/FastifyBackend.ts:68

Optionally register a global error handler.

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

void

HttpServerBackend.setErrorHandler


setNotFound(handler): void

Defined in: src/http/backend/FastifyBackend.ts:60

Optionally register a catch-all not-found handler.

(req) => HttpResponse | Promise<HttpResponse>

void

HttpServerBackend.setNotFound


withPlugin(plugin, options?): Promise<void>

Defined in: src/http/backend/FastifyBackend.ts:39

Escape hatch: register a native Fastify plugin (e.g. @fastify/cors).

unknown

object

Promise<void>