API for Current cases and more stuff about COVID-19 or the Novel Coronavirus Strain https://corona.lmao.ninja/
GET Request | Output |
---|---|
https://corona.lmao.ninja/all | Returns all total cases, recovery, and deaths. |
https://corona.lmao.ninja/countries | Returns data of all countries that has COVID-19 |
https://corona.lmao.ninja/countries?sort={parameter} | Returns data of each country sorted by the parameter |
https://corona.lmao.ninja/countries/{country-name} | Returns data of a specific country. If an exact name match is desired pass ?strict=true in the query string |
https://corona.lmao.ninja/states | Returns all United States of America and their Corona data |
https://corona.lmao.ninja/jhucsse | Return data from the Johns Hopkins CSSE Data Repository (Provinces and such) |
https://corona.lmao.ninja/historical | Get historical data from the start of 2020. (JHU CSSE GISand Data) |
https://corona.lmao.ninja/historical/{country-name} | Get historical data from the start of 2020 for a specific country. (JHU CSSE GISand Data) |
Tutorial Made By Apollo#6000
Packages Needed novelcovid
Step 1: Install novelcovid
npm i novelcovid
Step 2:
Use either .getAll()
or .getCountry()
function to retrieve the given data.
// We define the package
let covid = require('novelcovid');
// In this case we will be using .getAll()
// If you would like a .getCountry() tutorial, feel free to join our support server
let data = covid.getAll();
console.log(data);
/* Returns
{ cases: 220877,
deaths: 8988,
recovered: 85782,
updated: 1584612112774 }
*/
Step 3: Once we have called the API, we can access the data that was given!
let covid = require('novelcovid');
// IMPORTANT: Inorder to access the data, we will need to create an async function.
(async () => {
let data = await covid.getAll();
// Since we are using an async function, we need to return the data.
return console.log(`
Total Cases: ${data.cases}
Total Deaths: ${data.deaths}
Total Recovered: ${data.recovered}
Last Updated on: ${data.updated}`);
})();
Note
Since data.updated
returns milliseconds, you can do new Date(data.updated)
as it returns an ISO Date
You can read more about new Date() here
For further support, you can join our discord server! More Tutorials can be found there too! https://discord.gg/EvbMshU
Thanks goes to these wonderful people (emoji key):
Ethan Winters 🐛 |
EliteDaMyth 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!