libflitter/middleware/Middleware~ Middleware

The base class for all app-space middleware.


new Middleware()



(static) services

Defines the services required by this unit. The 'app' service is included by default.

(private) _di_allow_defer :boolean

If true, the injector will defer the class if the class requests any services that the container is missing. These services are filled in later and added to the prototype and any instances. True by default.

  • boolean

(private) _di_deferred_instances :Array.<module:flitter-di/src/Injectable~Injectable>

Collection of instances of this class that need to have the deferred service instances injected into them when the deferred services are finally provided.

(private) _di_deferred_services :Array.<string>

List of services that were deferred and not provided at the time of injection.

  • Array.<string>


(async) test(req, res, next, args)

Executes the middleware. This method is called when a request flows through a route that includes this middleware. Calling the next() method allows the request flow to continue.

Name Type Description
req express/request

the Express request

res express/response

the Express response

next function

handler that, if called, allows the request flow to continue

args module:libflitter/middleware/MiddlewareUnit~MiddlewareUnit#mw

optional arguments passed in from the call to