Utilizing FastAPI and MariaDB to create easy to use CRUD (Create-Read-Update-Delete) API in Python. With help of docker this project create two containers:
- FastAPI: to maintaine the API
- MariaDB: to host the database and perform the CRUD operations.
- Make sure you have docker installed 🐳
docker --version
If not please refere to the Docker Website and install from there.
- Navigate to your prefered destination and clone the repository
git clone https://github.com/ahmadhatahet/fastapi-crud-docker.git
cd fastapi-crud-docker
- start docker containers:
docker compose up -d
-
Visit: http://localhost:5404/docs
-
To ingest some sample data for the first time please visit the migrate url. You will recive a response like this:
{'message': 'Created tables and inserted sample data successfully!'}
Here is a PDF showing all CRUD operation in action.
FastAPI uses the 5404 port, if the port is already occubied in your local, kindly change the port to a prefered one in docker-compose.yml
line 13
from 5404
to another one.