Chapter 4: Templating in FastAPI

Now that we have learned how to handle responses from requests including errors in the previous chapter, we can proceed to render the responses from the request on a web page. In this chapter, we will learn how to render responses from our API to a web page using templates powered by Jinja, which is a templating language written in Python designed to help the rendering process of API responses.

Templating is the process of displaying the data gotten from the API in various formats. Templates act as a frontend component in web applications.

By the end of this chapter, you will be equipped with the knowledge of what templating is and how to use templates to render information from your API. In this chapter, we’ll ...

Get Building Python Web APIs with FastAPI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.