Type Alias: ExpressHTTPEntrypointOptions
ExpressHTTPEntrypointOptions =
object
The options of expressHTTPEntrypoint.
Properties
app?
optionalapp?:Express
An existing express application to add the action routes to.
Default
a new express applicationbefore?
optionalbefore?: (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
Returns
void | Promise<void>
body?
optionalbody?: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
{limit: '1mb'}fallback?
optionalfallback?: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?
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
all the interfacesinput?
optionalinput?: (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
the query parameters, then the properties of an object body over themmiddlewares?
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?:ExpressResponder
How the results and the errors of the actions are written.
Default
JSONResponderserver?
optionalserver?:ServerOptions&object
The options of the Node.js HTTP server (keepAliveTimeout, headersTimeout, requestTimeout, in milliseconds…).
Type Declaration
headersTimeout?
optionalheadersTimeout?:number
keepAliveTimeout?
optionalkeepAliveTimeout?:number
requestTimeout?
optionalrequestTimeout?:number
stop?
optionalstop?: () =>void|Promise<void>
Run when the adapter stops, after the server is closed.
Returns
void | Promise<void>