GithubHelp home page GithubHelp logo

sohelkabir / api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from disease-sh/api

1.0 1.0 0.0 1.17 MB

API for Current cases and more stuff about COVID-19 or the Novel Coronavirus Strain

License: GNU General Public License v3.0

JavaScript 99.74% Dockerfile 0.26%

api's Introduction

Buy Me A Coffee

All Contributors

Join our Server!

Discord server

API

API for Current cases and more stuff about COVID-19 or the Novel Coronavirus Strain https://corona.lmao.ninja/

Recommended by Postman

NovelCovid API is recommended by Postman here

Documentation

NovelCovid/API Documentation can be found here

Installation

Redis

  1. Download redis from https://redis.io/topics/quickstart
  2. Start redis server using redis-server

Project

  1. Fork and clone git repository
  2. In root project folder, create a new file called config.json
  3. Copy contents for config.example.json to new config.json file
  4. Replace password field with "" and port field to whatever localhost port you want.
  5. From root of project, run npm start
  6. In your browser, go to localhost:{port} to test your local changes

Run with docker-compose.

  1. Fork and clone git repository
  2. In root project folder, make a new file called config.json
  3. Copy contents for config.example.json to new config.json file
  4. Replace password field with "yourpassword" and port field same within docker-compose.yml.
  5. Replace redis host "localhost" with "redis".
  6. Run command docker-compose up --build -d.

Loading and using our NPM Package

We suggest you load the module via require, considering ES modules in Node.js are not yet stable.

const covid = require('novelcovid');

Documentation

Executing a method will return a Promise. The examples here utilise async/await to access the data.

// Declare the package
const covid = require('novelcovid');

// Now we create a async/await
(async () => {

    // Now we await it.
    let all = await covid.getAll();

    // Make sure you return it, this usually implies if you are using this inside a function.
    // Use \n to break lines.
    return console.log(`Cases: ${all.cases}\nDeaths: ${all.deaths}\nRecovered: ${all.recovered}`)
})()

Sorting the data.

Some methods can be sorted.

const covid = require('novelcovid');

(async () => {
    let sortedCountries = await covid.getCountry({sort: 'recovered'});
    return console.log(sortedCountries);

    let sortedStates = await covid.getState({sort: 'deaths'});
    return console.log(sortedStates);
})();

Filtering for a specific country/state.

const covid = require('novelcovid');

(async () => {
   // Specific Country
   let specificCountry = await covid.getCountry({country: 'United States'});
   return console.log(specificCountry);

   // Specific State
   let specificState = await covid.getState({state: 'New York'});
   return console.log(specificCountry);
})();

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

Sources:

https://www.worldometers.info/coronavirus/

https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_time_series

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


EliteDaMyth

๐Ÿ’ป

Ethan Winters

๐Ÿ›

dicedtomato

๐Ÿ’ป

apollyon600

๐Ÿ“–

James Shelley

๐Ÿ‘€

Ryan Harlow

๐Ÿ›

Ali Tas

๐Ÿ›

Walter Corrales

๐Ÿ’ป

Ahmad Awais โšก๏ธ

๐Ÿ“–

MrAugu

๐Ÿ›

Ayyan Lewis

๐Ÿ›

Ben Sommer

๐Ÿ› ๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

api's People

Contributors

ebwinters avatar akshatj27 avatar buster95 avatar diced avatar allcontributors[bot] avatar alitas avatar benjamin-sommer avatar ryanharlow avatar matyrics avatar lauridskern avatar dill0wn avatar apollyon600 avatar romfrolov avatar moinahmed9999 avatar longv1 avatar saisk73 avatar s1mb10t3 avatar nikhil-wagh avatar mraugu avatar antidoxable avatar jessestuart avatar jamesshelley avatar felipebma avatar kant avatar chriswales95 avatar cal-hagner avatar benjaminrichardson-ms avatar thealiilman avatar ahmadawais avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.