Writing the Server with Node.js and MongoDB, Part II
Building the server in Chapter 7 wasn’t too difficult, I’m sure you’ll agree, but it’s only half of the equation. Responding to requests properly is fine, but it doesn’t help us actually work with data—as you’ll recall, there was no code in the previous chapter that dealt with that.
In this chapter, we’ll look at the code that takes care of working with data and acts as a service that the server code in main.js uses, namely, the code in the DAO.js file. This will be a relatively small chapter because the amount of code to look at is not that great, but that’s a consequence of using Node.js and Mongoose, and, at the end of the day, it is a Very Good Thing.
A Data Access Object ...