Looking for the way to add user management to my site.
Site: Working with Node.js & Express, when creating the initial project with Express, the app.js
file contains these lines:
app.use('/', routes);
app.use('/users', users);
In addition, a file users.js
is created under routes folder. My question is how to manage users, force login, and show different views for regular user / admin user. I wish to find a simple example / tutorial.
Storage: Working with MongoDB & mongoose, I noticed the database has Users folder built-in. I want to save users data (user + password + preference) on MongoDB. What is the way to do this?