title: Access rest api using nodejs
body: <p>I am trying to access opencorporates.com and using their REST API.
  I got this code from <a href="https://stackoverflow.com/questions/5643321/how-to-make-remote-rest-call-inside-node-js-any-curl">How to make remote REST call inside Node.js? any CURL?</a>. But it is not fetching any data. I tried wget on the url and it worked perfectly fine. </p>
  
  <p>app.js</p>
  
  <pre><code>var https = require('http');
  
  var optionsget = {
  host : 'opencorporates.com', 
  
  port : 8080,
  path : '/v0.2/companies/search?q=barclays+bank&amp;jurisdiction_code=gb', 
  method : 'GET' 
  };
  
  
  console.info('Options prepared:');
  console.info(optionsget);
  console.info('Do the GET call');
  
  var reqGET = https.get(optionsget, function(res) {
  console.log("statusCode: ", res.statusCode);
  console.log("headers: ", res.headers);
  
  
  res.on('data', function(d) {
      console.info('GET result:\n');
      process.stdout.write(d);
      console.info('\n\nCall completed');
    });
  
  });
  
  reqGet.end();
  reqGet.on('error', function(e) {
  console.error(e);
  });
  </code></pre>