Type Alias: FastifyHTTPEntrypointOptions
FastifyHTTPEntrypointOptions =
object
The options of fastifyHTTPEntrypoint.
Properties
before?
optionalbefore?: (app,context) =>void|Promise<void>
Run before the action routes are added, to register the application's own plugins, hooks and routes. A failure fails the entrypoint start.
Parameters
app
FastifyInstance
context
Returns
void | Promise<void>
fallback?
optionalfallback?: (request,reply) =>unknown
The handler of the requests that match no route and whose path is outside the action prefixes, such as the pages of a web application. The unmatched requests inside the action prefixes, and all of them without a fallback, are answered with a RouteNotFoundException (404).
Parameters
request
FastifyRequest
reply
FastifyReply
Returns
unknown
fastify?
optionalfastify?:FastifyInstance|FastifyServerOptions
An existing fastify instance to add the action routes to, or the options of the instance to create (bodyLimit, trustProxy, logger…). The adapter closes the instance when it stops, a given one included.
Default
a new fastify instance with its default options (a body limit of 1 MiB)heartbeat?
optionalheartbeat?:number
The interval between the comments keeping the event streams (EventsResult) alive through the proxies, in milliseconds.
Default
15000host?
optionalhost?:string
The host or address the server listens on.
Default
every interface, as the other HTTP adapters (::, or 0.0.0.0 without IPv6)
input?
optionalinput?: (request) =>Record<string,unknown>
Build an action's input from a request. The route parameters are always merged over its result.
Parameters
request
FastifyRequest
Returns
Record<string, unknown>
Default
the query parameters, then the properties of an object body over them (an array body is ignored)middlewares?
optionalmiddlewares?:MiddlewareDefinition[]
The middlewares of this adapter's actions, run after the entrypoint's global middlewares.
name?
optionalname?:string
The adapter name, to tell apart several HTTP adapters of one entrypoint.
port?
optionalport?:number
The port the server listens on; 0 picks a random free port. The entrypoint fails to start when the port is in use.
Default
80respond?
optionalrespond?:FastifyResponder
How the results and the errors of the actions are written.
Default
FastifyJSONResponderstop?
optionalstop?: () =>void|Promise<void>
Run when the adapter stops, after the server is closed.
Returns
void | Promise<void>