Skip to content

billiramirez/statistics-covid-api

Repository files navigation

Statistics Covid-19

This API will retrieve endpoints for Covid-19 Status, you can add your own record if you are authorized to do it.

Stack for this API

Programming Language

Web Server

API Design

Authentication

Database and ORM

Deployment

Run this Project Locally

  1. Clone the repo on your computer, please make sure you have installed Nodejs, Yarn and Git on your machine.
https://github.com/billiramirez/statistics-covid-api.git
  1. Install Dependencies
yarn install
  1. Create a .env file in the root of your project, you'll find a .env.example that will looks this:
X_RAPID_API_HOST=
X_RAPID_API_KEY=
API_X_RAPID_API_URL=
MONGO_USER=
MONGO_PASSWORD=
AUTH_TOKEN=
  1. Run the Project
  yarn start:dev

You need to seed the database with initial data, you can go to http://localhost:4000/v1/statistcs to sync data, for this endpoint you'll need to be logged in.

If you need to sign up, you can go to: http://localhost:4000/v1/auth/signup to create your account, and this will provide you a token you can use for performing this operation.

Then you can try this endpoint http://localhost:4000/v1/statistcs

Desing of the API

Since this project is using the Open API Specification along with Express Open APi, this will help you to interact with the endpoints. Having the project running locally you can import the API Documentation in POSTMAN as Link, paste this URL: http://localhost:4000/v1/openapi.json and then import it, this will create a collection for you, out of the box with the available endpoints. You'll be ready to go with this setup.

Paste URL Collection to import

This will generate the Collection for you:

Colleciton

You can also paste that openapi.json url to this URL: https://petstore.swagger.io/

Swagger UI Collection

Deployment

You can deploy this app to your favorite hosting provider, for this demo we're using Heroku, just make sure to provide the environemnt variables