FastAPI is a modern, high-performance Python web framework for building APIs quickly and efficiently.
- Fast — One of the fastest Python frameworks available, on par with NodeJS and Go
- Easy — Designed to be simple to use and learn
- Automatic Docs — Generates interactive API documentation automatically at
/docs - Type Safe — Built on Python type hints for cleaner, more reliable code
pip install fastapi uvicornfrom fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"message": "Hello, World!"}uvicorn main:app --reloadThen open your browser at http://127.0.0.1:8000
| URL | Description |
|---|---|
/docs |
Interactive Swagger UI |
/redoc |
ReDoc documentation |
- Python 3.7+
- fastapi
- uvicorn