I'm a beginner of nodejs . I have a Https api, and I use it via request-promise. How to return a global variable from this function?
Here is my code:
import rp from 'request-promise';
let options = {
uri: `https://devapi.heweather.net/v7/warning/now?location=${cityId}&key=${apiKey}&gzip=n`
};
async function warrningApi(alert){
let wAlert = await rp(options);
console.log(wAlert);
return wAlert = alert;
};
warrningApi()