Social Media API built using FastAPI
https://fastapi-social-media-api.herokuapp.com/
- OAuth Authentication using JWT Token and Expiry Time.
- Login with credentials.
- User :-
- Create a user.
- Get all users.
- Get a specific user by its id.
- Update a user.
- Delete a user.
- Post :-
- Get all posts.
- Get a specific post by its id.
- Things only Registered and Authorized User can perform.
- Create a post.
- Update a post.
- Delete a post.
- Vote :-
- Only Register and Authorized User's can Vote on any post.
- Create a virtual environment using the command :-
virtualenv venv
- Now install all the requirements using the command :-
pip3 install -r requiremnts.txt
- Now add the .env file in the root directory and add values to the folloing keys :-
DATABASE_HOSTNAME=
DATABASE_PORT=
DATABASE_PASSWORD=
DATABASE_NAME=
DATABASE_USERNAME=
SECRET_KEY=
ALGORITHM=
ACCESS_TOKEN_EXPIRE_MINUTES=
- Now just run the command :-
uvicorn app.main:app --reload
- Lets Break this command in pieces to understand this uvicorn command.
- Uvicorn is an ASGI web server implementation for Python. Learn more about Uvicorn
- app is the parent directory for the main file (Note :- any other name can also be given to the directory as well as to the main file).
- app.main:app at last app is the instance of the fastAPI.
- --reload flag is used so that if any changes occur server gets reload by itself and the changes could get visible.