title: in express.js, any way to capture request to both json and html in one function?
body: <p>Does anybody know a way in <b>express.js</b> to capture requests in a single function for both html and json? </p>
  
  <p>Essentially I want a single route for both <code>/users</code> and <code>/users.json</code> - like rails does with its routes -> controller.  </p>
  
  <p>That way, I can encapsulate the logic in a single function and decide to render either html or json. </p>
  
  <p>Something like:</p>
  
  <pre><code>app.get('/users[.json]', function(req, res, next, json){
    if (json)
      res.send(JSON.stringfy(...));
    else
      res.render(...); //jade template
  });
  </code></pre>
  
  <p>Could I use a param perhaps? </p>