The 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.
Args:
f = App:lookup_middleware(name)
Returns the middleware registered for that name, or nil if none.
Args:
Returns:
App:register_middleware(name, mw)
Registers the middleware mw for name. If there is already a registered middleware for name, throws an error.
Args:
App:resolve_middleware(mws)
Resolves the middleware identified by a string in the array mws to their actual function (or callable table).
Args:
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.
commit 3ebfbd288b8e5c95fdf8ce2027a0e94cfa1c8976 Author: Martin Angers <martin.n.angers@gmail.com> Date: 2021-02-25T14:07:12-05:00 Update to reflect Request:validate_body