Fast API Tutorial, Part 25: Dependencies in path operation decorators, global dependencies

preview_player
Показать описание
There may be situations where you have multiple routes that all use the same dependencies and it's tedious to have to copy and paste the same code for each route. In these situations it would be helpful to be able to add dependencies to the APIRouter that you're using, or even to the entire FastAPI app as a whole.

In this video I show you how you can use dependencies on a larger scale than just at the individual route level.

Рекомендации по теме
Комментарии
Автор

Great video! I would love to know how to mock these dependencies when testing if they reside in the path operation decorator

vincenziorocks
Автор

instead of depends we can that function in the routes itself right like flask

aswathvanan