Skip to content

示例: 实现天气预报查询服务

August 2, 2024 by ccforeverd

使用 Nest 请求和风天气免费 API 实现天气预报查询服务

原文链接: https://mp.weixin.qq.com/s/E3MPoAjxKQZhAK9oFjngqg

组件展示

拼音
天气

关键提取

  • 使用 @nestjs/axios 时要配合 rxjs
Example
const { data: cityData } = await firstValueFrom(
  this.httpService.get(
    `https://geoapi.qweather.com/v2/city/lookup?location=${cityPinyin}&key=${key}`,
  ),
);