Skip to content

Type Alias: ExpressHookContext ​

ExpressHookContext = object

What the before hook of expressHTTPEntrypoint receives besides the express application: the entrypoint's module, the HTTP server (not listening yet) and the routes the actions will occupy.

Properties ​

actionPrefixes ​

readonly actionPrefixes: string[]

The first segment of each action route ('/device', '/user'…). A route starting with a parameter (/:id) adds none.


isActionPath ​

readonly isActionPath: (requestPath) => boolean

Tell whether a request path belongs to the actions: it equals one of the action prefixes or starts with one followed by /.

Parameters ​

requestPath ​

string

Returns ​

boolean


module ​

readonly module: Module

The module owning the entrypoint, to get the application's objects from (await module.getObject('db')).


routes ​

readonly routes: Map<string, Set<string>>

Each action route mapped to its HTTP methods, as declared ('/users/:id' → {'get', 'delete'}).


server ​

readonly server: Server

The HTTP server serving the express application. It does not listen yet when the hook runs; attach other servers to it there (such as a socket.io server, see the server option of socketIOServiceEntrypoint).

Released under the MIT License.