示例: 实现天气预报查询服务
August 2, 2024 by
使用 Nest 请求和风天气免费 API 实现天气预报查询服务
原文链接: https://mp.weixin.qq.com/s/E3MPoAjxKQZhAK9oFjngqg
组件展示
关键提取
- 和风天气控制台: https://console.qweather.com/#/apps
- 和风天气开发文档: https://dev.qweather.com/docs/configuration/api-config/
- 使用
@nestjs/axios
时要配合rxjs
Example
const { data: cityData } = await firstValueFrom(
this.httpService.get(
`https://geoapi.qweather.com/v2/city/lookup?location=${cityPinyin}&key=${key}`,
),
);