Skip to content

Type Alias: ExpressHTTPEntrypointOptions ​

ExpressHTTPEntrypointOptions = object

The options of expressHTTPEntrypoint.

Properties ​

app? ​

optional app?: Express

An existing express application to add the action routes to.

Default ​

ts
a new express application

before? ​

optional before?: (app, context) => void | Promise<void>

Run before the action routes are added, to add the application's own express middlewares and routes (they take precedence over the actions). A failure fails the entrypoint start.

Parameters ​

app ​

Express

context ​

ExpressHookContext

Returns ​

void | Promise<void>


body? ​

optional body?: false | { limit?: string | number; }

The JSON and URL-encoded body parsers, with their size limit (bytes, or a text such as '5mb'); a larger body is answered with an error (413). false installs no parser, leaving the parsing to the application. The parsers are installed after the before hook, so the middlewares added there do not see a parsed body.

Default ​

ts
{limit: '1mb'}

fallback? ​

optional fallback?: RequestHandler

The handler of the requests that match no action and whose path is outside the action prefixes, such as the pages of a web application (see staticUI). The unmatched requests inside the action prefixes, and all of them without a fallback, are answered with a RouteNotFoundException (404).


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 ​

ts
all the interfaces

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 ​

Request

Returns ​

Record<string, unknown>

Default ​

ts
the query parameters, then the properties of an object body over them

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?: ExpressResponder

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

Default ​

ts
JSONResponder

server? ​

optional server?: ServerOptions & object

The options of the Node.js HTTP server (keepAliveTimeout, headersTimeout, requestTimeout, in milliseconds…).

Type Declaration ​

headersTimeout? ​

optional headersTimeout?: number

keepAliveTimeout? ​

optional keepAliveTimeout?: number

requestTimeout? ​

optional requestTimeout?: number


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.