Skip to content

Type Alias: FastifyHTTPEntrypointOptions ​

FastifyHTTPEntrypointOptions = object

The options of fastifyHTTPEntrypoint.

Properties ​

before? ​

optional before?: (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 ​

FastifyHookContext

Returns ​

void | Promise<void>


fallback? ​

optional fallback?: (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? ​

optional fastify?: 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 ​

ts
a new fastify instance with its default options (a body limit of 1 MiB)

heartbeat? ​

optional heartbeat?: number

The interval between the comments keeping the event streams (EventsResult) alive through the proxies, in milliseconds.

Default ​

ts
15000

host? ​

optional host?: 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? ​

optional input?: (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 ​

ts
the query parameters, then the properties of an object body over them (an array body is ignored)

middlewares? ​

optional middlewares?: MiddlewareDefinition[]

The middlewares of this adapter's actions, run after the entrypoint's global middlewares.


name? ​

optional name?: string

The adapter name, to tell apart several HTTP adapters of one entrypoint.


port? ​

optional port?: 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 ​

ts
80

respond? ​

optional respond?: FastifyResponder

How the results and the errors of the actions are written.

Default ​

ts
FastifyJSONResponder

stop? ​

optional stop?: () => void | Promise<void>

Run when the adapter stops, after the server is closed.

Returns ​

void | Promise<void>

Released under the MIT License.