Awesome
COVID-19 Dashboard API
A REST API client for the COVID-19 Dasoboard
Getting Started
Create your .env
file
Run the following command to generate a secret key first:
openssl rand -hex 32
Then add the followings to your .env
file:
SECRET_KEY=<SECRET_KEY>
ALGORITHM="HS256"
ACCESS_TOKEN_EXPIRE_DAYS=<TOKEN_LIFETIME_IN_DAYS>
Setup virtual environment if you haven't done so
virtualenv venv
source venv/bin/activate
Install the dependencies
pip install -r requirements.txt
Setup your database
The app relies on Firestore on Google Cloud Platform (GCP). Create a project on GCP and initialise your Firestore database in native mode. Make sure you also initialise gcloud cli with gcloud init
.
Obtain a hashed password with the following python code:
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
password="your_password"
print(pwd_context.hash(password))
Finally on Firestore, create a users
collection and add a document with the followng fields:
{
"username": "username",
"hashed_password": "hashed_password",
"disabled": false
}
Run the app
uvicorn app.main:app --reload
Go to http://127.0.0.1:8000/docs
for Swagger docs or http://127.0.0.1:8000/redoc
for ReDoc