I have simple code and its getting data from external api in nodejs . but am unable to get data from it . Here is the code
econst request = require('request');
const options = {
url: api_url,
method: 'GET',
headers: {
'Accept': 'application/json',
'Accept-Charset': 'utf-8'
}
};
request(options, function(err, res, body) {
let json = JSON.parse(body);
// console.log(json.foods[0]);
APIDATA = json.foods[0];
}
yetone = APIDATA;
);
how can u get this apidata outside it and can use it somewhere else