title: Node JS - wait for full response
body: <p>So I have an API (written in PHP over Nginx).
  I use Node JS in order to send requests to that API.
  Sometimes it takes 5-7 seconds until the API finishes what it needs to do.</p>
  
  <p>The problem is that Node JS doesn't wait for the full response to arrive.</p>
  
  <pre><code>http.get(url, function(response){
      // called right away instead of waiting until it finishes
  });
  </code></pre>
  
  <p>I already tried using the .end() &amp; .close() events - no luck.
  How can I make NodeJS to wait? or...how do I make PHP to notify node "hey, now I've finished".
  Thanks.</p>
  
  <p>One important thing: when I try to CURL to the API, it does wait for the full response.</p>