This project is a simple FastAPI application that exposes a REST endpoint GET /items returning a JSON list of sample items.
- FastAPI framework for building APIs.
- Built-in OpenAPI support for API documentation.
- Dockerized application for easy deployment.
-
Build the Docker image:
docker build -t fastapi-sample . -
Run the Docker container:
docker run -p 8000:8000 fastapi-sample
Note: Ensure the Dockerfile installs all dependencies listed in requirements.txt, including uvicorn, and sets the correct CMD to run the FastAPI application.
-
Access the API:
- Visit
http://localhost:8000/itemsto see the sample items. - Open
http://localhost:8000/docsfor the automatically generated API documentation.
- Visit
- Docker
- Python 3.9+
To run the application locally without Docker:
-
Install dependencies:
pip install -r requirements.txt
-
Start the application:
uvicorn main:app --host 0.0.0.0 --port 8000