title: How to connect to gitHub api using nodejs from a secure network?
body: <p>I am using the below code to get the repositories from gitHub. When I use it from Home network I am able to retrieve the list of repositories, but If I try to fetch the repo from other network it gives me this error: 'connect ECONNREFUSED'. I am new to nodejs, so still wondering how to go about solving this issue.</p>
  
  <p>Any ideas?</p>
  
  <pre><code>var https = require("https");
  var userName='xyz';
  var options = {
  host :"api.github.com",
  path : '/users/'+userName+'/repos',
  method : 'GET'
  }
  
  var request = https.request(options, function(response){
  var body = '';
  response.on('data',function(chunk){
      body+=chunk;
  });
  response.on('end',function(){
      var json = JSON.parse(body);
      var repos =[];
      json.forEach(function(repo){
          repos.push({
              name : repo.name,
              description : repo.description
          });
      });
      console.log('the repos are  '+ JSON.stringify(repos));
  });
  
  });
  request.on('error', function(e) {
  console.error('and the error is '+e);
  });
  request.end();
  </code></pre>