The ASGI server (Uvicorn) receives the HTTP request and passes it to the app, middleware runs in order, the router matches the path and method, dependencies are resolved (including sub-dependencies), parameters and body are validated, and your function runs.
The return value is filtered and serialized through the response model, response middleware runs in reverse order, and the response goes back to the client; background tasks run after the response is sent.
Loading…