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 frontend
- Deploy our backend to Heroku – a platform-as-a-service
In this chapter, we will cover the following main topics:
- Introducing our app
- Creating a MongoDB instance for our app
- Creating...