Q: FastAPI vs Flask — which should I learn?
Both. Flask for simpler apps and microservices. FastAPI for APIs needing async, auto-docs, and validation. Many teams use both.
Q: Is FastAPI production-ready?
Yes. Used by Microsoft, Uber, Netflix, and many startups. It's as production-ready as Flask or Django.
Q: Should I use async or sync endpoints?
Use async for I/O-bound tasks (DB queries, HTTP calls, file I/O). Use sync for CPU-bound tasks. FastAPI handles both.
Q: How do I test FastAPI apps?
Use pytest with httpx.AsyncClient or FastAPI's TestClient (based on Starlette).
BackgroundTasks