title: How to share the common logic between controller in Express.js?
body: <p>I had used the express to build my website, and I have a special require.I had set the routers as follow:</p>
  
  <pre><code>/* home */
  app.get('/', function (req, res, next) {
      homeRacingHandle(req,res);
  });
  
  /* racing list */
  app.get('/racing',function (req, res, next) {
      homeRacingHandle(req,res);
  });
  </code></pre>
  
  <p>There is just a few differents between the <a href="http://racing.biketo.com/" rel="nofollow">home page</a> and the <a href="http://racing.biketo.com/racing" rel="nofollow">racing list page</a>.
  My method to process the common logic is like above.And the homeRacingHandle function according the variable <code>isHome</code> to decide which page to render.</p>
  
  <pre><code>    var location = req.path.split('?').toString();
      var isHome = location==='/' &amp;&amp; true || false;
  </code></pre>
  
  <p>This method works for me.But I don't know wether is a good way to process.Are there any other best practice?</p>