title: What does "./bin/www" do in Express 4.x?
body: <p>I just started to learn about Express 4.0 in my Node.js app, and I found that it generated <code>./bin/www</code> file, on which only the application server and port settings are written and everything others like middleware and routing is defined in <code>./app.js</code> file.</p>
  
  <p>However, I'm not sure what this <code>./bin/www</code> does. I've used Express 3.x and I have always defined server and port settings as well as routing and middleware on the identical <code>./app.js</code> file, and launched my node app with <code>node app.js</code>. So what's the point of using the <code>./bin/www</code>? Does it only separate the server and port definition from others?</p>
  
  <p>Right now, when I create the package using express-generator, the <code>package.json</code> includes the following definition:</p>
  
  <pre><code>"scripts": {
      "start": "node ./bin/www"
  }
  </code></pre>
  
  <p>However, I wonder whether I should launch my app using <code>node ./bin/www</code>, or <code>npm start</code>. Which command should I run to start my app?</p>
  
  <p>And also, when I deploy my app to heroku, what should I write in the <code>Procfile</code> file? Is <code>web: node app.js</code> enough?</p>