title: NodeJS - TypeError: app.listen is not a function
body: <p>I know this question kind of already exists, but they answers did not rectify my problem.</p>
  
  <p>The error is "TypeError: app.listen is not a function";</p>
  
  <p>My full code is below, thanks in advance. (PS, I do not have anything running on the same port)   </p>
  
  <pre><code>var io = require('socket.io')(app);
  var fs = require('fs');
  var serialPort = require("serialport");
  
  var app = require('http');
  
  app.createServer(function (req, res) {
      fs.readFile(__dirname + '/index.html',
          function (err, data) {
              res.writeHead(200);
              res.end(data);
          });
  }).listen(1337, '127.0.0.1');
  
  
  var port = new serialPort(process.platform == 'win32' ? 'COM3' : '/dev/ttyUSB0', {
      baudRate: 9600
  });
  
  port.on( 'open', function() {
      console.log('stream read...');
  });
  
  port.on( 'end', function() {
      console.log('stream end...');
  });
  
  port.on( 'close', function() {
      console.log('stream close...');
  });
  
  port.on( 'error', function(msg) {
      console.log(msg);
  });
  
  port.on( 'data', function(data) {
      console.log(data);
  
      var buffer = data.toString('ascii').match(/\w*/)[0];
      if(buffer !== '') bufferId += buffer;
  
      clearTimeout(timeout);
      timeout = setTimeout(function(){
          if(bufferId !== ''){
              id = bufferId;
              bufferId = '';
              socket.emit('data', {id:id});
          }
      }, 50);
  });
  
  io.on('connection', function (socket) {
      socket.emit('connected');
  });
  
  app.listen(80);
  </code></pre>