title: express.static(): "Undefined is not a function"
body: <p>Been Googling for a while in order to find an answer to this question but I still can't get to find the matter in my code. I'm trying to make my very first Socket.io app that simply outputs a message to the console when a user connects.</p>
  
  <p>Here's the error I get from Node.js:</p>
  
  <p><img src="https://i.stack.imgur.com/lNNDn.png" alt=""></p>
  
  <p>And here is my source code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var port = process.argv[2];
  
  var express = require('express');
  var app = express();
  var path = require('path');
  
  app.get('/', function(req, res) {
    res.render('index.ejs');
  })
  .use(app.static(path.join(__dirname, '/public')));
  
  var io = require('socket.io')(app.listen(port));
  
  io.on('connection', function(socket) {
    console.log('Someone connected');
  });
  
  console.log('Listening on port ' + port);</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thanks in advance for your advice!</p>