Chapter 8. Persisting your data with MongoDB

 

This chapter covers

  • Using Mongoose, an official MongoDB library for controlling the database with Node
  • Securely creating user accounts using bcrypt
  • Using Passport for user authentication.

I have three favorite chapters in this book.

My very favorite is chapter 3, where we discuss the foundations of Express. I like that chapter because the goal is to really explain Express. In my opinion, it’s the most important chapter of the book, because it explains the framework conceptually.

Chapter 10 is my second favorite. As you’ll see, it discusses security, and I love putting a hacker hat on and trying to break Express applications. It’s a lot of fun (and, incidentally, terribly important).

This chapter is my final favorite. Why? Because after this chapter, your applications will feel real. No more dinky example apps. No more data that quickly disappears. Your Express applications will have user accounts, blog posts, friend requests, calendar appointments—all with the power of data persistence.

Nearly every application has some kind of data, be it blog posts or user accounts or cat pictures. As we’ve discussed, Express is generally an unopinionated framework. Fitting in with this mantra, Express doesn’t dictate how you store your data. So how should we approach it?

8.1. Why MongoDB?

 
 
 

8.2. Talking to Mongo from Node with Mongoose

 

8.3. Authenticating users with Passport

 
 
 
 

8.4. Summary

 
 

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest