title: HTTP Request in Node Js
body: <p>I know how http request works and I know how to send and receive response.
  This is the sample code of http request.</p>
  
  <pre><code>var http = require('http');    
  var options = {
  host: 'www.nodejitsu.com',
  path: '/',    
  port: '1337',    
  method: 'POST'
  };
  
  callback = function(response) {
   var str = ''
   response.on('data', function (chunk) {
   str += chunk;
  });
  
    response.on('end', function () {
     console.log(str);
    });      
  
  }
  
  var req = http.request(options, callback);
  
  req.write("hello world!");
  req.end();
  </code></pre>
  
  <p>In my site everything working fine Server B send request to server A and server A response to server B. But, one time I face a problem when there is huge no of traffic on server A and it was unable to receive any request from server B which halt the whole process.</p>
  
  <p>So is there is any error block in request to handle this type of errors ?
  I googled alot and try this type of foolish things but it does not work for me</p>
  
  <pre><code>callback = function(response,error) {
  
   if(error){
     console.log(error)
   }else{
     var str = ''
     response.on('data', function (chunk) {
     str += chunk;
     });
     response.on('error', function (err) {
     console.log(err);
     }); 
   }
  });
  </code></pre>