【发布时间】:2022-02-04 02:38:07
【问题描述】:
我在节点 JS 中有一个 API,它调用另一个 API - openWeatherMap。 这是我调用天气 API 时的邮递员响应:
但是这个响应带来了 API 中的每个参数,我想向用户展示例如 temp.min。我该怎么做?
【问题讨论】:
-
请分享调用其他api后发送该有效负载的nodejs代码部分
-
request({ url: url, json: true }, function (error, response) { if (error) { console.log('Unable to connect to Forecast API'); } else { res .status(200).send(response.body.list[0].main.temp_min); } })
-
在发送之前做一个控制台日志,看看数据是否存在
标签: javascript node.js json api openweathermap