title: ExpressJS: normalizePort function is really necessary?
body: <p>I used <code>express-generator</code> for a new project.</p>
  
  <p>In file <code>bin/www</code> exists the function <code>normalizePort</code>:</p>
  
  <pre><code>...
  
  var http_port = 3000;
  
  var port = normalizePort(process.env.PORT || http_port);
  app.set('port', port);
  
  ...
  
  // Normalize a port into a number, string, or false.
  
  function normalizePort(val) {
    var port = parseInt(val, 10);
  
    if (isNaN(port)) {
      // named pipe
      return val;
    }
  
    if (port &gt;= 0) {
      // port number
      return port;
    }
  
    return false;
  }
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>Is really necessary the function or I can will simply?</p>
  
  <pre><code>app.set('port', parseInt(process.env.PORT, 10));
  </code></pre>
  
  <p>The function is generic and avoid possibles errors?</p>
  
  <p>I use <a href="https://github.com/motdotla/dotenv" rel="nofollow noreferrer">dotenv</a> and <a href="https://github.com/rolodato/dotenv-safe" rel="nofollow noreferrer">dotenv-safe</a> module for load my file .env</p>