I have a problem with request's callback ! i want to return for example the body of the request's response but I don't know how to do it... Please Help me !
const request = require('request');
function doCall(my_url, callback) {
request({
url: my_url,
method: 'GET'
}, function (err, res, body) {
return callback(body);
});
}
body = doCall('https://google.com/', function(res){
console.log(res); // It works
return res;
})
console.log(body); // But here I haven't my body from the request
anotherCall(body);
Thank you !!!!!