title: nodejs - why does my async function run twice?
body: <p>I am new to node.js and learning from tutorials online.
  I was trying out the following piece of code :</p>
  
  <pre><code>var http = require("http");
  
  // create a server
  http.createServer(function(req, res) {
      console.log("Received Request");
      res.writeHead(200, {'Content-Type':'application/json'});
      res.end("{'status':'200', 'message':'Hello World'}");
      console.log("Response Sent");
  }).listen(process.env.PORT, process.env.IP);
  </code></pre>
  
  <p>I did receive the correct response but in console the output was :</p>
  
  <pre><code>Received Request
  Response Sent
  Received Request
  Response Sent
  </code></pre>
  
  <p>I wanted to know why was my code running twice ?? Am I making some mistake ?
  Please help !! </p>