Skip to content

Instantly share code, notes, and snippets.

@luisenriquecorona
Last active May 15, 2019 20:09
Show Gist options
  • Save luisenriquecorona/5c5c820314a9869b223b30e1c97ae3ce to your computer and use it in GitHub Desktop.
Save luisenriquecorona/5c5c820314a9869b223b30e1c97ae3ce to your computer and use it in GitHub Desktop.
httpGetAsync Function Definition
let https = require('https');
function httpGetAsync(url,callback) {
return https.get(url,
function(response) {
var body = ";
response.on('data', function(d) {
body += d; });
response.on('end', function() {
let parsed = JSON.parse(body)
callback(parsed)
})
}
);
}
//This is a simple function that uses
//an https module from a node to
//fire an AJAX call to get the
//response back.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment