GithubHelp home page GithubHelp logo

mrezaamini / covid-19-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 174 KB

Covid-19 statistics Restful API for , perfect example for praccticing and implementing an API with different roles, authentication and routes connected to a database

License: GNU General Public License v3.0

JavaScript 100.00%

covid-19-api's Introduction

Covid-19-API

Covid-19 statistics Restful API for , perfect example for praccticing and implementing an API with different roles, authentication and routes connected to a database (i used mongodb as database for this project)

Table of Contents

Description:

In this API you have 3 types of users: Public, Admin (admins that can change statics for a specific country) and Super admin (who can add countries and assign list of admins to it). Different node modules are used here like Express, jwt(jsonwebtoken for authentications and giving users tokens),joi (for validating), nodemon( as dev-dependency), mongoose (for connecting to database) and bcrypt (for hashing password) that you can install them with npm install.

Pubilc APIs:

  • Specific Country - GET : return todayCases, todayDeaths, todayRecovered, critical and last update date for specific country
    http://localhost:3000/countries/france
  • All Countries - GET: returtn all countries statics (you can sort them with specified query)
    http://localhost:3000/countries/?sort=todayCases

Admin APIs:

  • Update Country Information (todayCases, todayDeaths, todayRecovered, critical) - PUT : update statics for country that admin has the prmission for
    http://localhost:3000/countries/france

Super Admin APIs:

  • Create new Admin (adminUsername, adminPassword) - POST: creating new admin user
    http://localhost:3000/admin

  • Create new Country - POST: creating new country with no information (just the given name)
    http://localhost:3000/countries/france

  • Update country permissions(counrtyName, adminIDs, add) - PUT : adding/removing admins from country permissions (with add=false you can remove admin's permission)
    http://localhost:3000/countries/country

In addition, there are APIs to check database, registering superAdmins and logging in.

Available Scripts:

In the project directory, you can run:

npm instal

intall packages that project needs (start with this)!

npm start

Runs the app in the development mode.
Open http://localhost:3000 in your brower or use advanced softwares ( or websites ) like POSTMAN to try and test it.

(Note: for connecting to database you have to have mongodb installed, And run mongod locally)

Support + Feedback

Include information on how to get support.

  • easily contact me via email

Thank You

Thanks for paying attention, and hope it would be useful!

License

Link to LICENSE doc.

covid-19-api's People

Contributors

mrezaamini avatar

Watchers

 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.