title: Cannot GET /foo when using express.Router()
body: <p>I'm trying to figure out why the routing doesn't work if I use <code>expressjs</code>, I have this code:</p>
  
  <pre><code>const express = require('express');
  const app = express();
  const router = express.Router();
  
  app.get('/foo', function (req, res) {
      res.send('Hello World.')
  });
  </code></pre>
  
  <p>the code above works well, but if I replace the route with this:</p>
  
  <pre><code>router.get('/foo', function(req, res, next) {
      res.send('This is api.')
  });
  </code></pre>
  
  <p>I get:</p>
  
  <blockquote>
    <p>Cannot GET /foo when using express.Router()</p>
  </blockquote>