Register an additional content type handler for content negotiation. JSON is registered by default.
Returns the authentication configuration, or null if
useAuthentication() has not been called.
Returns a snapshot of all registered endpoints. Useful for generating OpenAPI specs or other documentation.
Returns a snapshot of all registered WebSocket subscription endpoints.
Consumed by @cleverbrush/server-openapi to emit the AsyncAPI spec.
Returns a snapshot of all registered webhook definitions.
Consumed by @cleverbrush/server-openapi to emit the webhooks map.
Register an endpoint and its handler.
An EndpointBuilder instance (e.g. from endpoint.get(...)).
The typed handler function.
Optionaloptions: EndpointOptions<E>
Optional per-endpoint middleware.
Register all endpoints from a HandlerMapping created by
mapHandlers. This is the bulk equivalent of calling
.handle() for each endpoint individually.
The mapping produced by mapHandlers(endpoints, handlers).
Configure the DI service collection.
Receives the ServiceCollection for registrations.
Add middleware to the matched-request pipeline after authentication. Middleware is executed in the order it is added. CORS short-circuits and unmatched routes do not enter this pipeline.
Enable authentication with one or more schemes.
Registers middleware that authenticates protected requests and sets
ctx.principal. CORS preflights are handled before this middleware.
Enable authorization enforcement.
Registers a global middleware that checks endpoint authorize()
metadata against the authenticated principal.
Must be called after useAuthentication().
Optionalconfig: AuthorizationConfigEnable the server-side request batching endpoint.
Once enabled, the server accepts POST <path> (default /__batch)
containing an array of sub-requests and processes each one through the
full middleware and handler pipeline, returning an array of
sub-responses in a single HTTP reply.
Pair this with the batching() middleware from @cleverbrush/client/batching
on the client side.
ServerBatchingOptions (all fields optional).
Enable server-wide CORS before routing and authentication. Accepted preflights return 204 without running ordinary middleware. Requests with disallowed origins return 403 before handlers run. Configuration is validated and copied when the server starts listening.
Register a webhook definition.
Webhooks are recorded for OpenAPI spec generation only — they are not served as HTTP routes by the runtime server.
A WebhookDefinition created with defineWebhook.
Enable the GET /health endpoint that returns { ok: true } (200).
Useful for load balancer and container readiness probes.
The path is available as HEALTHCHECK_PATH.
Fluent builder for constructing and starting an HTTP server.
Example