covidinfo.js
v2.0.4
Published
Get The Latest Info about covid worldwide and countries
Downloads
4
Readme
covidinfo.js
Get The Latest Info about covid worldwide and countries This package is using mathdro API, Feel free to use.
installation
npm i covidinfo.js
or
npm i covidinfo.js -g
Basic Usage
Here are the examples of getting worldwide covid info
const covid = require('covidinfo.js');
covid.Worldwide().then(res => {
console.log(res);
});
/*{
{
confirmed: {
value: 124143841,
detail: 'https://covid19.mathdro.id/api/confirmed'
},
recovered: {
value: 70416344,
detail: 'https://covid19.mathdro.id/api/recovered'
},
deaths: { value: 2733634, detail: 'https://covid19.mathdro.id/api/deaths' },
dailySummary: 'https://covid19.mathdro.id/api/daily',
dailyTimeSeries: {
pattern: 'https://covid19.mathdro.id/api/daily/[dateString]',
example: 'https://covid19.mathdro.id/api/daily/2-14-2020'
},
...
}*/
Here are the examples of getting country covid info
const covid = require('covidinfo.js');
covid.getCountry('USA').then(res => {
console.log(res);
});
/*{
{
confirmed: {
value: 29920378,
detail: 'https://covid19.mathdro.id/api/countries/USA/confirmed'
},
recovered: {
value: 0,
detail: 'https://covid19.mathdro.id/api/countries/USA/recovered'
},
deaths: {
value: 543793,
detail: 'https://covid19.mathdro.id/api/countries/USA/deaths'
},
lastUpdate: '2021-03-24T03:24:08.000Z'
}
}*/
Get Total Confirmed
Worldwide Covid info:
const covid = require('covidinfo.js');
covid.Worldwide().then(res => {
console.log(res.confirmed.value.toLocaleString());
});
// this will output 124,143,841
Country Covid info:
const covid = require('covidinfo.js');
covid.getCountry('USA').then(res => {
console.log(res.confirmed.value.toLocaleString());
});
// This will output 29,920,378
get Total Recovered
Worldwide Covid info:
const covid = require('covidinfo.js');
covid.Worldwide().then(res => {
console.log(res.recovered.value.toLocaleString());
});
// this will output 70,416,344
Country Covid info:
const covid = require('covidinfo.js');
covid.getCountry('indonesia').then(res => {
console.log(res.recovered.value.toLocaleString());
});
// This will output 1,304,921
get Total Deaths
Worldwide Covid info:
const covid = require('covidinfo.js');
covid.Worldwide().then(res => {
console.log(res.deaths.value.toLocaleString());
});
// this will output 2,733,634
Country Covid info:
const covid = require('covidinfo.js');
covid.getCountry('indonesia').then(res => {
console.log(res.deaths.value.toLocaleString());
});
// This will output 39,865
Discord
my Discord is (0L_0V2)#2021, You Can also try my bot. My Bot Have Covid command too and more features. If you need help, DM Me.