Skip to content

Instantly share code, notes, and snippets.

@rdiego26
Created November 7, 2014 18:09
Show Gist options
  • Save rdiego26/588307d00ae9fb836589 to your computer and use it in GitHub Desktop.
Save rdiego26/588307d00ae9fb836589 to your computer and use it in GitHub Desktop.
NodeJS https request GitHub API
var https = require('https');
var options = {
host: 'api.github.com',
path: 'users/rdiego26/repos',
method: 'GET',
headers: {
'user-agent': 'node.js'
}
};
var req = https.request(options, function(res) {
console.log(res.statusCode);
res.on('data', function(d) {
process.stdout.write(d);
});
});
req.end();
req.on('error', function(e) {
console.error(e);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment