var request = require('request');
var options = {
url: 'https://api.github.com/repos/request/request',
headers: {
'User-Agent': 'request'
}
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
var info = JSON.parse(body);
console.log(info.stargazers_count + " Stars");
console.log(info.forks_count + " Forks");
}
}
exports.parse = function(){
request(options, callback);
}
Hi, how can i get info variable located inside callback function.
Sorry, i'm beginner in js and didn't find answer inside my brain / peace
requestaccept a custom callback?