forked from apalmer37/Project2_PPE_Charity_OnlineStore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_db.js
29 lines (24 loc) · 717 Bytes
/
api_db.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const http = require("https");
// This API provides information about Coronavirus disease, from several reliable sources, like Johns Hopkins CSSE, CDC, WHO and others.
const options = {
"method": "GET",
"hostname": "covid-19-data.p.rapidapi.com",
"port": null,
"path": "/country/all",
"headers": {
"x-rapidapi-host": "covid-19-data.p.rapidapi.com",
"x-rapidapi-key": "aec57077b7mshe7c9917e3720dc3p12dae9jsn6c72418df371",
"useQueryString": true
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();