title: TypeError: require(...) is not a function (Node.js) [server.js]
body: <pre><code>const express = require('express');
  const bodyParser = require('body-parser');
  const app = express();
  
  const port = process.env.PORT || 3000;
  
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({
    extended: true,
  }));
  
  app.use('/', require('../routes')(express));
  
  exports.server = app.listen(port, () =&gt; {
    console.log('Server active on', port);
  });
  </code></pre>
  <p>Am I missing a npm package?</p>
  <blockquote>
  <p><strong>Error</strong></p>
  <pre><code>TypeError: require(...) is not a function
  at Object.&lt;anonymous&gt; (C:\xampp\htdocs\url-shortener\src\server.js:12:34
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:418:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:533:3
  </code></pre>
  </blockquote>