Summary
Exploring the core details of a framework always helps us create a comprehensive plan and design to build quality applications to the required standards. We have learned that FastAPI injects all its incoming form data, request parameters, query parameters, cookies, request headers, and authentication details into the Request
object, and the outgoing cookies, response headers, and response data are carried out to the client by the Response
object. When managing the response data, the framework has a built-in jsonable_encoder()
function that can convert the model into JSON types to be rendered by the JSONResponse
object. Its middleware is one powerful feature of FastAPI because we can customize it to handle the Request
object before it reaches the API execution and the Response
object before the client receives it.
Managing the exceptions is always the first step to consider before creating a practical and sustainable solution for the resiliency and health of a microservice...