title: Express.js 4 routes not matching with router.route
body: <p>I'm trying to get the hang of router.route in Express 4. The docs make it sound awesome, but it's just not working for me.</p>
  
  <p>If I use the command line tool to make a standard app and then add routes/contacts.js that looks like this:</p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  
  router.route('/:contactid')
    .get(function(req, res) {
      res.send('(get) It worked '+contactid);
    })
  
  module.exports = router;
  </code></pre>
  
  <p>Then in app.js add:</p>
  
  <pre><code>var contacts = require('./routes/contacts');
  
  ...
  
  app.use('/contacts', contacts);
  </code></pre>
  
  <p>I'd expect <code>http://localhost:8000/contacts/1</code> to match the route from contacts.js. However, I get an error that essentially indicates it's not matching any routes in contacts.js</p>
  
  <pre><code>Error: Not Found
      at Layer.app.use.res.render.message [as handle] (project1/app.js:31:15)
      at trim_prefix (project1/node_modules/express/lib/router/index.js:226:17)
      at c (project1/node_modules/express/lib/router/index.js:198:9)
      at Function.proto.process_params (project1/node_modules/express/lib/router/index.js:251:12)
      at next (project1/node_modules/express/lib/router/index.js:189:19)
      at next (project1/node_modules/express/lib/router/index.js:150:14)
      at next (project1/node_modules/express/lib/router/index.js:166:38)
      at Function.proto.handle (project1/node_modules/express/lib/router/index.js:234:5)
      at Layer.router (project1/node_modules/express/lib/router/index.js:23:12)
      at trim_prefix (project1/node_modules/express/lib/router/index.js:226:17)
  </code></pre>
  
  <p>If I add routes using a static prefix, it works as expected:</p>
  
  <pre><code>router.get('/1', function(req, res) {
    res.send('It worked!');
  });
  
  // http://localhost:8000/contacts/1 says "It worked!"
  </code></pre>
  
  <p>Any tips on what I'm doing wrong?</p>