title: app.post is not a function express node
body: <p>I had all my routes in server.js but I wanted to make it modular and put into a folder called routes. I created a file called apis.js in routes folder but as I did that I get <code>TypeError: app.post is not a function</code></p>
  
  <p>server.js:</p>
  
  <pre><code>var express    = require('express');
  var app        = express();
  
  var bodyParser = require('body-parser');
  var urlencode = bodyParser.urlencoded({ extended: true});
  
  app.use(express.static('public'));
  
  var apis = require('./routes/apis');
  app.use('/', apis);
  
  module.exports = app;
  </code></pre>
  
  <p>apis.js:</p>
  
  <pre><code>  module.exports = function(app){
  
    app.get('/', function(req, res) {
      res.send('OK');
    });
  
    app.post('/idea', function(req, res) {
    ...
    });
  
  };
  </code></pre>
  
  <p>Also, having <code>module.exports = app</code> in server.js is important as I have tests running and I want a instance of app everytime.</p>
  
  <p>What am I missing?</p>