Fast API
Installation
# Install
pip install "fastapi[standard]"
# Develop
fastapi dev main.py
# Production
fastapi run main.pyFeature
the interactive API documentation will be generated automatically
Uvicorn is used as a web server for Python
Concurrency
FastAPI applications run on ASGI servers like Uvicorn or Hypercorn. ASGI is an interface which allows communication between web server and Asynchronous web application and frameworks
@app.get("/test")
async def test():
test = await fn()
return testError Handling
Middleware
Sub Applications
If you need to have two independent FastAPI applications, with their own independent OpenAPI and their own docs UIs, you can have a main app and "mount" one (or more) sub-application(s).
The middleware and error handler will also be independent between sub applications
Mounting
"Mounting" means adding a completely "independent" application in a specific path, that then takes care of handling everything under that path
Last updated
Was this helpful?