Module: middlewares

The middlewares module of the webserver adapter.

This module makes possible to register pre-routing and post-routing middlewares to the web server via the configuration.

Used only internally by the adapter.

Methods

(static) addMiddlewares(container, server, middlewares)

Add middlewares to the webserver

Parameters:
Name Type Description
container Object

The container context

server Object

The server object

middlewares Object

It is an object, that has two Array type properties: { preRouting: [], postRouting: [] }.
Both arrays can contain so called middleware adder functions. These adder function get one parameter, that is the container object, and must return with express middleware function.
This adder function makes possible to inject the container context to the middlewares, so those will be able to access to all the functions (e.g.: logger) and config parameters that are available to the adapter during the startup phase.