Social Media App using FastAPI
To run this project locally follow the following steps :
git clone https://github.com/Arnav-2004/MediaBridgeX.git
cd MediaBridgeX
python -m venv venv (optional)
.\venv\Scripts\activate.bat (Refer: https://docs.python.org/3/library/venv.html#how-venvs-work)
pip install -r requirements.txt
Create a .env file in the root folder that is MediaBridgeX and populate the following fields :
DATABASE_USERNAME=
DATABASE_PASSWORD=
DATABASE_HOSTNAME=
DATABASE_PORT=
DATABASE_NAME=
SECRET_KEY=
ALGORITHM=
ACCESS_TOKEN_EXPIRE_MINUTES=
To generate a SECRET_KEY you can run openssl rand -hex 32 or ssh-keygen -t rsa -b 4096 -m PEM -f private.key
NOTE : Must have mysql community server installed.
uvicorn app.main:app
The server will be running at http://127.0.0.1:8000/
To access the documentation go to http://127.0.0.1:8000/docs
- Post route
GET/posts/ - Fetch all the posts.GET/posts/{id} - Fetch a single post by id.POST/posts/ - Create a post. (Must be authorized)PUT/posts/{id} - Update a post by id. (Must be authorized and author of the post)DELETE/posts/{id} - Delete a post by id. (Must be authorized and author of the post)
- Users route
POST/users/ - Regesiter an user.GET/users/{id} - Fetch a user by id.
- Auth route
POST/login - Login an user. (Generates JSON Web Token)
- Likes route
POST/like/ - Like and dislike a liked post.