title: Cannot Load Routes in ./src/routes/index.js from ./app.js
body: <p>very new to nodejs here. I've tried to put routes in <code>app.js</code> without problem. However, after moving all the routes to a separate file under <code>PROJECT_DIR/src/routes/index.js</code>, and then I open the page in browser it says "Cannot GET <code>/wines</code>". Here's code in <code>app.js</code> and <code>src/routes/index.js</code>:</p>
  
  <pre><code>// app.js
  var express = require('express');
  var app = express();
  var path = require('path');
  
  global.app = express();
  require('./src/routes/index');
  // also tried: require(path.join(__dirname, './src/routes/index'));
  
  global.server = app.listen(3000, '0.0.0.0', function () {
    var host = server.address().address;
    var port = server.address().port;
  
    console.log('Example app listening at http://%s:%s', host, port);
  });
  </code></pre>
  
  
  
  <pre><code>// ./src/routes/index.js
  // tried console.error(app); and it printed all the stuff about app in the server log
  app.get('/wines', function(req, res) {
    res.send([{name:'w1'}, {name:'w2'}]);
  });
  
  app.get('/', function (req, res) {
    res.send('Hello World!');
  });
  </code></pre>
  
  <p>I'm sure I'm missing something. Any help is appreciated!</p>