7

Building a Backend with FastAPI

In the previous chapters, you learned the basic mechanics of authentication and authorization, and now you are ready to implement it and secure a web API, built with FastAPI. In this chapter, you will put this knowledge to good use and create a simple, yet fully functional REST API showcasing used cars and their pictures.

In this chapter, you will learn about the following actions, which can be thought of as a loosely coupled blueprint when creating a REST API with FastAPI.

This chapter will cover the following topics:

  • Connecting the FastAPI instance to MongoDB Atlas by using the Python Motor driver
  • Defining the Pydantic models according to the specification and initial creation of the FastAPI application

Get Full Stack FastAPI, React, and MongoDB - Second Edition 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.