5

Building the Backend for Our Application

In the previous chapter, you learned just enough React to be able to think in components and JSX and to express your UI interactivity in terms of Hooks and handlers. It is time to put this new creativity to good use and build something!

In this chapter, we will take a simple yet concrete application specification and try to create a simple backend. We will do the following:

  • Connect to an instance of MongoDB and learn about Python drivers
  • Connect asynchronously to our database
  • Create Pydantic models for our data
  • Make a more manageable application structure with APIRouter
  • Define path operations for our CRUD functionality
  • Introduce FastAPI middleware and use it to enable our backend to connect to our ...

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