This project is a proof-of-concept (POC) web API built using the FastAPI library. It is designed to demonstrate the integration of a web API with a database service, including basic CRUD operations and API key authentication.
- Clone the Repo
git clone https://github.com/RMI/web-api-poc
cd web-api-poc
- Create an
.env
file to store the desired API key, (internal) API port, and DB port.
cp .env.example .env
# build the image
docker compose build
# run the container
docker compose up --detach
# do both
docker compose up --detach --build
The API and API documentation (Swagger) will be accessible at http://localhost:8000.
curl -X 'GET' \
'http://localhost:8000/scenarios' \
-H 'accept: application/json' \
-H 'X-API-Key: abc123'
Defaults to the API key "abc123", but an alternate key (matching what is in your .env
file) can be input and submitted on the page.
docker compose down
# also delete the database volume when shutting down the container
docker compose down --volumes
This project is licensed under the MIT License