UNPKG

corona-api

Version:

A lightweight and simplified corona stats package

90 lines (58 loc) 1.96 kB
# covid-19-api - A very lightweight and simple corona-stats-api ![Badge](https://img.shields.io/static/v1?label=version&message=v0.0.1&color=green) ![Badge](https://img.shields.io/static/v1?label=package-name&message=covid-19-api&color=violet) ![Badge](https://img.shields.io/static/v1?label=difficulty-of-usage&message=medium&color=yellow) ![Badge](https://img.shields.io/static/v1?label=developed-by-&message=Unique/Dev_and_Ctk&color=blue) ![Badge](https://img.shields.io/static/v1?label=node&message=>=0.12&color=purple) ## usage ```js const covid = require("corona-api"); var api = new covid(); api.all().then(r => console.log(r)); //Logs a array of global stats //outout as below ``` ```js { updated: 1590385056654, cases: 5502590, todayCases: 8135, deaths: 346761, todayDeaths: 327, recovered: 2302469, active: 2853360, critical: 53223, casesPerOneMillion: 706, deathsPerOneMillion: 44.5, tests: 71646009, testsPerOneMillion: 9244, population: 7750542970, activePerOneMillion: 368.15, recoveredPerOneMillion: 297.07, criticalPerOneMillion: 6.87, affectedCountries: 215 } ``` * get every country's data which are affected ```js const covid = require("corona-api"); var api = new covid(); api.countries_all().then(r => console.log(r)); //Logs a array of all countries name and corona details that are affected ``` * get a specified country data ```js const covid = require("corona-api"); var api = new covid(); api.country("india").then(r => console.log(r)); //Logs a array of all covid details in a specifiec country ``` * get every US state's data ```js const covid = require("corona-api"); var api = new covid(); api.states_all().then(r => console.log(r)); //Logs a array of all US states affected by covid ``` ```js const covid = require("corona-api"); var api = new covid(); api.state("washington").then(r => console.log(r)); //Logs a array of specified US state's covid details ```