Friday, 17 March 2017

Difference between array of middlewares and compose-middleware?

I was suggested to use compose-middleware module to have an array of middlewares. Then I noticed this works just fine with express.js:

router.post('/editPassword', doAction ); 

var doAction = [
   function(req, res, next){
      //whatever
      next();
   },

   function(req, res, next){
      //whatever
   }
]

What's the main advantage of using compose-middleware then?



via Alvaro

No comments:

Post a Comment