title: Use an array of middlewares at express.js
body: <p>I'm trying to use an array of middlewares. Well, more like a combination of function names and arrays.</p>
  
  <p>Instead of having:</p>
  
  <pre><code>router.post('/editPassword', validate, changePassword, sendConfirmation);
  </code></pre>
  
  <p>I would like to have something like:</p>
  
  <pre><code>router.post('/editPassword', validate, [changePassword, sendConfirmation] ); 
  </code></pre>
  
  <p>That would look like:</p>
  
  <pre><code>router.post('/editPassword', validate, doAction ); 
  </code></pre>
  
  <p>Where <code>doAction</code> would be an array like this:</p>
  
  <pre><code>var doAction = [
     //equivalent of changePassword
     function(req, res, next){
        //whatever
        next();
     },
  
     //equivalent to the previous sendConfirmation
     function(req, res, next){
        //whatever
     }
  ]
  </code></pre>
  
  <p>But it seems it is failing and going back to the <code>validate</code> step after the <code>next()</code> within the first function in <code>doAction</code>.</p>
  
  <p>I'm looking for a way to simplify the middleware chaining including some middleware steps under the same name.</p>