Skip to content

Instantly share code, notes, and snippets.

@gildean
Created May 16, 2014 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gildean/d94407a71de371cd3ce5 to your computer and use it in GitHub Desktop.
Save gildean/d94407a71de371cd3ce5 to your computer and use it in GitHub Desktop.
the simplest https request
var https = require('https');
https.get('https://registry.npmjs.org/', function responseHandler(res) {
var response = '';
res.on('data', function dataCallback(chunk) {
response += chunk;
});
res.on('end', function endCallback() {
var json = JSON.parse(response);
console.log(json);
});
}).on('error', function errorHandler(e) {
console.error(e);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment