title: node http and express listening difference
body: <p>I am new to node and express. I have come across two ways of creating an express app that listens on a specific TCP port which, as far as I can tell, yield the same result. Could someone please shed some light to the difference to these, if there are any... It's the <strong>listen</strong> function</p>
  
  <p>Method 1 - using the express module only:</p>
  
  <pre><code>var express = require('express');
  
  var port = 8080;
  var app = express();
  app.set('port', port);
  ...
  // different listen method
  app.listen(app.get('port'), function(){ 
    console.log('now listening on port ' + app.get('port'));
  });
  </code></pre>
  
  <p>Method 2 - using the express and http modules:</p>
  
  <pre><code>var http = require('http'), 
      express = require('express');
  
  var port = 8080;
  var app = express();
  app.set('port', port);
  ...
  // different listen method
  http.createServer(app).listen(app.get('port'), function(){ 
    console.log('now listening on port ' + app.get('port'));
  });
  </code></pre>