tulip.pkg.middleware module exports the
middleware package. It enables app-level middleware (as opposed to route-specific middleware) in the order specified in the configuration. This means that requests will go through those middleware handlers in that order.
Registering this package provides the following method and field extensions.
App(req, res, nxt)
Sets up the
__call metamethod on the App's metatable so
that it can be used as initial middleware.
f = App:lookup_middleware(name)
Returns the middleware registered for that name, or nil if none.
Registers the middleware mw for name. If there is already a registered middleware for name, throws an error.
Resolves the middleware identified by a string in the array mws to their actual function (or callable table).
App.middleware: array of string|function
The list of middleware to apply to web requests. When the App is called as initial middleware, it triggers that chain of middleware next, in sequence.