π± WSGI vs ASGI, Uvicorn & Middleware: Let's Learn from ZERO!
If you've built (or are building) a React + FastAPI project, you've probably run a command like this without thinking much about it:
python -m uvicorn app.main:app --reload --port 8000
Enter fullscreen mode
Exit fullscreen mode
But what actually happens when a request travels from your React frontend to your Python backend? π€
In this post, we'll learn step by step, with no prior knowledge required :
β
WSGI vs ASGI
β
Synchronous vs Asynchronous web servers
β
The ASGI spec's minimal 3-callable interface ( scope , receive , send )
β
Uvicorn as an ASGI server
β
ASGI middleware
Let's go! π
1. πΌοΈ The Big Picture
Imagine you open Instagram and click on a post.β¦