Module 07 Summary
What this module established
Declare shared request-time rules as dependencies: they run before the handler, appear in the docs, and cannot be forgotten by whoever adds the next endpoint under time pressure.
Carry forward
- Build expensive objects once behind a cached dependency and inject them. A module-level global cannot be replaced in a test.
dependency_overridesis why you inject rather than import. The whole request path runs with the costly part replaced.- Dependencies are for lifecycles and boundaries. Business logic put there becomes reachable only through HTTP.
Before moving on
Move on when your expensive dependency is built once, overridable in a test, and no dependency contains business logic.
