title: Node and Express Routing - 404 error
body: <p>I'm getting back 404 error using nodemon and not quite sure where the problem is. Any tips / resources appreciated!</p>
  
  <p>project root</p>
  
  <pre><code>$ curl http://127.0.0.1:3000/v1/protected
  Cannot GET /v1/protected
  </code></pre>
  
  <p>nodemon: <code>"GET /v1/protected/ HTTP/1.1" 404 26 "-" "curl/7.49.1"</code></p>
  
  <p>index.js</p>
  
  <pre><code>var express = require('express');
  var morgan = require('morgan');
  var bodyParser = require('body-parser');
  var mongoose = require('mongoose');
  
  var app = express();
  
  var router = require('./services/router');
  
  mongoose.connect('mongodb://localhost:introToBackend/introToBackend');
  
  app.use(morgan('combined'));
  app.use(bodyParser.json());
  app.use(express('/v1', router));
  
  const PORT = process.env.PORT || 3000;
  var HOST = process.env.HOST || '127.0.0.1';
  
  console.log('Listening on', HOST, PORT);
  app.listen(PORT, HOST);
  </code></pre>
  
  <p>services/router.js</p>
  
  <pre><code>var router = require('express').Router();
  
  function protectedRoute(req, res, next) {
    res.send("The secret!");
  }
  
  router.route('/protected')
    .get(protectedRoute);
  
  module.exports = router;
  </code></pre>