title: setting up a middleware in router.route() in nodejs (express)
body: <p>what I want it to do.</p>
  
  <pre><code> router.post('/xxxx', authorize , xxxx);
  
    function authorize(req, res, next)
     {
      if(xxx)
          res.send(500);
      else
       next(); 
     }
  </code></pre>
  
  <p>I want to check for session in each route.
  But since the routers are written in this way.</p>
  
  <pre><code>router.route('/xxx/xxxx').post(function(req, res) {
      // blah lah here...
      //
  });
  </code></pre>
  
  <p>So how can I set up a middleware that will check for session and I wanted to make things a bit more generic and wanted to have a single authorize function doing a single thing instead of checking in every request.Any suggestions.</p>