Node.js 6.x Blueprints
上QQ阅读APP看书,第一时间看更新

Installing additional middleware

As you can see in the previous sections, we used some middleware to display messages and the user icon using the gravatar. In this section, we will see how to install some very important modules for our application.

Since we created templates for the signin, signup, and profile pages, we will need to store the users with login and password.

These are the middleware that we will use for this task, with the definition for each one:

Open your terminal/shell and type:

npm install connect-flash connect-mongo express-session gravatar passport passport-local -save

Note

As we can see, we will use MongoDB to store user data; you can find more information about MongoDB at https://www.mongodb.org/, and the installation process at https://docs.mongodb.org/manual/installation/ . We assume that you already have MongoDB installed on your machine and it is running.