Implementing a Backend Using Express, Mongoose ODM, and Jest
After learning the basics of Node.js and MongoDB, we will now put them into practice by building our first backend service using Express to provide a REST API, Mongoose object data modeling (ODM) to interface with MongoDB, and Jest to test our code. We will first learn how to structure a backend project using an architectural pattern. Then, we will create database schemas using Mongoose. Next, we will make service functions to interface with the database schemas and write tests for them using Jest. Then, we will learn what REST is and when it is useful. Finally, we provide a REST API and serve it using Express. At the end of this chapter, we will have a working backend service to be consumed by a frontend developed in the next chapter.
In this chapter, we are going to cover the following main topics:
- Designing a backend service
- Creating database schemas using Mongoose
- Developing and testing service functions...