Last active
May 15, 2019 20:09
-
-
Save luisenriquecorona/5c5c820314a9869b223b30e1c97ae3ce to your computer and use it in GitHub Desktop.
httpGetAsync Function Definition
This file contains hidden or 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
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