This is a FastAPI application for managing donuts. It allows you to create, retrieve, and upload images for donuts.
Clone the repository:
git clone https://github.com/Eastwesser/DonServalApi.git cd DonServalApi
python -m venv .venv
source .venv/bin/activate # On Windows use .venv\Scripts\activate
pip install -r requirements.txt
DATABASE_URL=postgresql://username:password@localhost:5432/database
alembic upgrade head
To run the FastAPI application, use the following command:
uvicorn api.main:app --reload
The application will be available at http://127.0.0.1:8000.
URL: /donuts/
Method: POST
Request Body:
{ "name": "Chocolate", "description": "Classic donut covered in exquisite Belgian chocolate." }
Response:
{ "id": 1, "name": "Chocolate", "description": "Classic donut covered in exquisite Belgian chocolate." }
URL: /donuts/{donut_id}/upload-image/
Method: POST
Request Body: file
Response:
{ "info": "Image uploaded successfully" }
URL: /donuts/{donut_id}
Method: GET
Response:
{ "id": 1, "name": "Chocolate", "description": "Classic donut covered in exquisite Belgian chocolate." }
URL: /donuts/{donut_id}/image
Method: GET
Response: Image File
Ensure you have Docker and Docker Compose installed.
Build the Docker images:
docker-compose build
Run the containers:
docker-compose up -d
This will start the bot and the PostgreSQL database in detached mode.
Contributions are welcome! Feel free to fork the repository and submit pull requests.