New: Intelligent Flashcards spaced-repetition decks for every topic, built to make things actually stick.
What does adding Depends(get_db) to a route's parameter actually let FastAPI do for that request?
Depends(get_db)
It works only with query parameters, not with things like request headers or cookies.
It registers get_db in a global dependency registry that FastAPI scans on startup.
get_db
It calls get_db fresh for this request and passes its return value into the route as db.
db