1. 首页
  2. 考试认证
  3. 其它
  4. weather 简单服务器提供来自公共API的天气数据(按IACA代码和日期)

weather 简单服务器提供来自公共API的天气数据(按IACA代码和日期)

上传者: 2024-10-17 16:53:06上传 ZIP文件 169.26KB 热度 8次

天气API简单的JSON API从三个来源按日期提供IATA区域的平均温度:OpenWeatherMap、WorldWeatherOnline和Wunderground。安装步骤:

  1. git clone 并进入项目目录:git clone weather && cd weather

  2. 安装依赖:npm install

  3. 复制配置文件:cp config.sample.json config.json

注意:不要忘记在配置文件中设置您的API密钥。

要启动服务器,请执行以下命令:

  • node index

测试命令:

  • npm test

API使用示例:

API 需要两个参数:IATA代码和日期(可以使用 Date() 解析的任何格式)。示例命令:


$ curl http://localhost:8030/VKO/2014-11-21

{\"temp\":-4.93}

下载地址
用户评论