I need to call a function that makes an http request and have it return the value to me through callback. However, when I try I keep getting null response. Any help?
Here is my code:
var url = 'www.someurl.com'
makeCall(url, function(results){return results})
makeCall = function (url, results) {
https.get(url,function (res) {
res.on('data', function (d) {
resObj = JSON.parse(d);
results(resObj.value)
});
}).on('error', function (e) {
console.error(e);
});
}