问题描述
我是nodejs的初学者。我有一个Https api,并且通过request-promise使用它。 如何从此函数返回全局变量?
这是我的代码:
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()
@H_502_6@
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)