Skip to content

python-spokane/getting-started-with-fastapi

Repository files navigation

Getting Started with FastAPI

Tools

Installation

git clone https://github.com/python-spokane/getting-started-with-fastapi
getting-started-with-fastapi
python -m virtualenv ./.venv
./.venv/Scripts/Activate.ps1
pip install -r requirements.txt

Example 1 - Hello World

uvicorn example1:app --reload

Example 2 - Models

uvicorn example2:app --reload

Example 3 - Validating

Run

uvicorn example3.main:app --reload

Tests

pytest ./example4/vehicle_test.py

Example 4 - Dependency Injection

Run

uvicorn example4.main:app --reload

Tests

pytest ./example4/vehicle_service_test.py
pytest ./example4/main_test.py

Example - Docker

cd ./example-docker
docker-compose build
docker-compose up

Example - Docker --reload

cd ./example-docker-reload
docker-compose build
docker-compose up

Example - Docker DIY

cd ./example-docker-diy
docker-compose build
docker-compose up

Example - Security

uvicorn example-security.main:app --reload

Example - Security - token

uvicorn example-security-token.main:app --reload

Example - Security - username + password

uvicorn example-security-password.main:app --reload

Example - Cars

cd ./example-cars
docker-compose build
docker-compose up

About

5/18/2021 - Getting Start with FastAPI

Topics

Resources

License

Contributing

Stars

Watchers

Forks