This is a simple FastAPI project with a basic API and tests.
-
Clone the repository:
git clone <repository_url> cd fastapi_project
-
Create a virtual environment and activate it:
python3 -m venv env source env/bin/activate OR for PowerShell .\env\Scripts\Activate.ps1 (use https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.4 in case of execution failure)
-
Install the dependencies:
pip install -r requirements.txt
-
Run the application:
uvicorn app.main:app --reload
-
Run the tests:
pytest
-
Build the Docker image:
docker build -t fastapi-project .
-
Run the Docker container:
docker run -p 80:80 fastapi-project
GET /
- Returns a welcome messageGET /items/{item_id}
- Returns item details with optional query parameterq