ServerBuilder
このコンテンツはまだ日本語訳がありません。
Defined in: src/http/HttpExtension.ts:19
Methods
Section titled “Methods”bind()
Section titled “bind()”bind(
routes):Promise<ServerBinding>
Defined in: src/http/HttpExtension.ts:51
Register the full route tree and bind. Returns the ServerBinding.
Parameters
Section titled “Parameters”routes
Section titled “routes”Returns
Section titled “Returns”Promise<ServerBinding>
useBackend()
Section titled “useBackend()”useBackend(
backend):ServerBuilder
Defined in: src/http/HttpExtension.ts:21
Override the default Fastify backend (or use Express / Hono).
Parameters
Section titled “Parameters”backend
Section titled “backend”Returns
Section titled “Returns”ServerBuilder
withErrorHandler()
Section titled “withErrorHandler()”withErrorHandler(
handler):ServerBuilder
Defined in: src/http/HttpExtension.ts:49
Last-resort handler for errors that escape every route-level
handleErrors(...), plus backend-internal errors (body-parse
failures, etc.). Overrides the framework’s default 500 mapping; if
it throws, the default mapping still applies. Requires a backend
that supports setErrorHandler (all shipped backends do).
Parameters
Section titled “Parameters”handler
Section titled “handler”(err, request) => HttpResponse | Promise<HttpResponse>
Returns
Section titled “Returns”ServerBuilder
withSecurityHeaders()
Section titled “withSecurityHeaders()”withSecurityHeaders(
options):ServerBuilder
Defined in: src/http/HttpExtension.ts:41
Security response headers for this whole server, stamped by the backend onto every response it writes — including the error, not-found and WebSocket upgrade-reject paths that never flow back through a middleware, and the throw short-circuits that skip one.
Left alone, a server sends X-Content-Type-Options: nosniff and nothing
else: it is the only header of the bundle that cannot change how an
existing application is embedded, framed or referred to. Passing
options opts into the full securityHeaders bundle — its own
defaults included, so X-Frame-Options: DENY and
Cross-Origin-Resource-Policy: same-origin come along and will break
iframes and cross-origin embedding if that is how the app is used.
false turns the mechanism off entirely.
A response’s own header always wins, whatever is configured here.
Requires a backend that supports setDefaultResponseHeaders (all
shipped backends do).
Parameters
Section titled “Parameters”options
Section titled “options”false | SecurityHeadersOptions
Returns
Section titled “Returns”ServerBuilder
