title: Pass data between express router and middleware
body: <p>I'm trying to write express middleware to check the validity of a JWT in the Authorization header. This seems quite easy but I don't want it to run on all routes (e.g. not on login/signup routers). </p>
  
  <p>So, I'd like to specify in the router declaration that a route should require a valid token. E.g. something like this</p>
  
  <pre><code>const controllers = require('../controllers');
  
  module.exports = (app) =&gt; {
  
      app.post('/auth/signup', controllers.auth.signup.post);
      app.post('/auth/login', controllers.auth.login.post);
  
      app.get('/teams', controllers.teams.get, {requiresToken:true});
  
  };
  </code></pre>
  
  <p>Except, .post and .get don't take a third parameter and the controller only takes (req,res,next) parameters so I can't really see a way of passing startic data for each route. I'm sure I'm missing something simple</p>