Module 01 Summary
What this module established
Build an API when something outside your process must call you - within one process an import is faster, typed, and cannot fail over the network. The contract is request, response, errors and guarantees: everything behind it is replaceable, and nothing in it can be silently withdrawn.
Carry forward
- FastAPI gives async I/O and fast validation, and more usefully one declaration serving as validation, serialisation and documentation. It does not make your handler faster.
- Use
async defwhen you await something. A blocking call insideasync defstalls every other request on that worker. - Add capability one stage at a time. State and queues add the most operational weight, and the commonest over-build is a database in week one.
Before moving on
Move on when you have a written contract including every error status, and a test named for each guarantee.
