This project was a API RESTful developed in Python using FastAPI to manage blog posts! It was a good example of how to use FastAPI to create a simple API with CRUD operations, NGINX to serve the API and Docker to containerize the application and make it easier to deploy.
- CRUD operations for blog posts (Create, Read, Update and Delete)
- API RESTful using FastAPI
- NGINX to serve the API
- Docker to containerize the application and manage the services
- Insomnia to test the API
- Well organized project structure with a clear separation of concerns
-
Clone the repository
git clone [email protected]:ViniciosLugli/2024-1A-T2-M10-A2.git
-
Change to the project directory
cd 2024-1A-T2-M10-A2
-
Go to the API directory
cd api
-
Set the virtual environment
python3 -m venv venv source venv/bin/activate
-
Install the dependencies
pip install -r requirements.txt
-
Run the API
python3 src/main.py
-
Access the API
The API will be available at http://0.0.0.0:3001
-
Run the services
In the root directory of the project:
docker compose up --build
-
Access the API
The API will be available at http://0.0.0.0:3000
You can access the API documentation at http://0.0.0.0:3000/docs on docker or http://0.0.0.0:3001/docs on local.
The logs file are located in the logs/logs.log file. Current logs are commited to the repository for demonstration purposes. based on the demonstration video, the logs are being written to the file.
You can use Insomnia to test the API. You can import the Insomnia file to have all the requests ready to use and test the API!