Created
November 7, 2014 18:09
-
-
Save rdiego26/588307d00ae9fb836589 to your computer and use it in GitHub Desktop.
NodeJS https request GitHub API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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