$ npm install --save middleware-container
Middleware container extends the boxed-injector functionality for use with express middleware. The use case for this is when middleware chains get complex.
The problem that this package solves is:
- Simplifying declarativeness of common middleware packages (multiple middlewares used often around your app - why declare multiple times?)
- Middleware dependency chains (avoid having to declare multiple middleware functions on multiple routes, and having to maintain them in the correct order // with all sub-middlewares)
- Middleware redundancy (sometimes middlewares have dependencies that may get executed multiple times if not composed)
middleware-container is built on top of boxed-injector
const MiddlewareContainer = ;const middlewares = ;middlewares;middlewares;middlewares;// /foo will have the entire middleware chain executedapp;