I wrote this project to explore clean architecture and put some of its principles into practice. Since I had no ideas for the project, I chose to develop a REST API for a classic blog
To install the dependencies, run the following command:
pip install -e .
Before running the project, make sure you have an env.sh
file in the env/
directory, containing the following variables:
#! /bin/bash
# JWT settings
export JWT_SECRET_KEY=
export JWT_ALGORITHM=HS256
export JWT_EXPIRES_IN=2
# PostgreSQL settings
export POSTGRES_USER=
export POSTGRES_PASSWORD=
export POSTGRES_DB=
export POSTGRES_HOST=
export POSTGRES_PORT=5432
# Server settings
export SERVER_HOST=0.0.0.0
export SERVER_PORT=8000
To run the project, execute:
bash scripts/start.sh
GET /posts
- Get all postsPOST /posts
- Create a new postGET /posts/{id}
- Get post by IDPATCH /posts{id}
- Update a post by post IDDELETE /posts/{id}
- Delete a post by post ID
POST /comments
- Create commentGET /comments/{id}
- Get comment by IDPATCH /comments/{id}
- Update comment by IDDELETE /comments/{id}
- Delete comment by IDGET /comments/?post_id=
- Get comments by post ID
POST /auth/register
- Register userPOST /auth/login
- Login user
GET /users/me
- Get current user
If you have any suggestions for improving the project, please create an Issue or Pull Request.