一分钟快速部署你自己的新型冠状病毒API ୧(๑•̀⌄•́๑)૭

Deploy your own new coronavirus API in one minute ୧(๑•̀⌄•́๑)૭

coro-api

新型冠状病毒 实时数据 api
项目Git地址: iotcat/coro-api
项目npm地址: iotcat/coro-api

API示例

获取全部

https://api.yimian.xyz/coro

根据省份

https://api.yimian.xyz/coro?province=山东

根据城市

https://api.yimian.xyz/coro?city=泰安

根据省和城(推荐)

https://api.yimian.xyz/coro?province=山东&city=泰安

快速部署

环境要求

  • nodeJS支持express任意版本
  • git任意版本

下载文件

1
$ git clone https://github.com/iotcat/coro-api.git & cd coro-api

安装依赖

1
$ npm install

启动

1
$ node index.js

访问

1
http://localhost:17676

进阶

GET参数

参数 描述 示例
province 省份(国家) 山东
city 城市 泰安

修改端口

index.js第9行修改默认端口。

禁止跨域

注释掉index.js第13行。

使用pm2守护进程

1
2
$ npm i -g pm2
$ pm2 start index.js --name coro-api -o /var/log/coro/api.out -e /var/log/coro/api.err --watch

Nginx配置

将以下内容加入server{}

1
2
3
location / {
proxy_pass http://127.0.0.1:17676;
}

如果你不是从根目录映射,记得去index.js中第11行app.get('/', f)修改成你的路径。

爬虫配置

爬虫使用coro-py, 请参考其文档。

开源协议

本项目使用MIT协议,允许非署名商业非商业使用。武汉加油!中国加油!!❤

coro-api

Novel coronavirus real-time data api
Project Git address: iotcat/coro-api
Project npm address: iotcat/coro-api

API example

Get all

https://api.yimian.xyz/coro

According to province

https://api.yimian.xyz/coro?province=Shandong

According to the city

https://api.yimian.xyz/coro?city=泰安

https://api.yimian.xyz/coro?province=Shandong&city=Taian

Quick deployment

Environmental requirements

  • nodeJS supports any version of express
  • Any version of git

download file

1
$ git clone https://github.com/iotcat/coro-api.git & cd coro-api

Installation dependencies

1
$ npm install

start up

1
$ node index.js

Access

1
http://localhost:17676

Advanced

GET parameters

Parameters Description Example
province Province (Country) Shandong
city ​​ city Tai’an

Modify port

Modify the default port from line 9 of index.js.

Cross-domain prohibited

Comment out line 13 of index.js.

Use pm2 daemon

1
2
$ npm i -g pm2
$ pm2 start index.js --name coro-api -o /var/log/coro/api.out -e /var/log/coro/api.err --watch

Nginx configuration

Add the following content to server{}

1
2
3
location / {
proxy_pass http://127.0.0.1:17676;
}

If you are not mapping from the root directory, remember to go to the 11th line of index.js and change app.get('/', f) to your path.

Crawler configuration

The crawler uses coro-py, please refer to its documentation.

Open Source Agreement

This project uses the MIT protocol, allowing non-signed commercial and non-commercial use. Go Wuhan! Go China! ! ❤