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:
Component |
Description |
More details |
|
User-friendly messages | |
|
Drive to connect with MongoDB | |
|
Store user sessions in the DB | |
|
Show a random user picture | |
|
Authentication middleware | |
|
Local user/password authentication |
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.