Utilizing Other Advanced Features
The previous chapters have already showcased several essential core features of the FastAPI framework. However, there are features not truly inherent to the framework that can help fine-tune performance and patch missing links in our implementations. These include session handling, managing Cross-Origin Resource Sharing (CORS)-related issues, and selecting the appropriate rendition types for an application.
Aside from the built-in features, there are workaround solutions proven to work with FastAPI when applied to the application, such as its session handling mechanism, which can function well using a JWT, and SessionMiddleware
. Concerning middleware, this chapter will also explore ways of customizing request and response filters other than applying the @app.middleware
decorator. Other issues such as using custom APIRoute
and Request
will be covered in this chapter to guide us on managing incoming byte body, form, or JSON data. Moreover, this chapter...