User management in node js with expression, mongodb as server database

Looking for a way to add user management to my site.

Website: Working with Node.js and Express when creating the source project using Express, the app.js file contains the following lines:

 app.use('/', routes); app.use('/users', users); 

In addition, the users.js file is created in the routes folder. My question is how to manage users, force login and show different views for a regular user / administrator. I want to find a simple example / tutorial.

Storage: When working with MongoDB and mongoose, I noticed that there is a Users folder in the database. I want to save user data (user + password + preference) on MongoDB. What is the way to do this?

+5
source share
1 answer

I followed this guide. http://scotch.io/tutorials/javascript/easy-node-authentication-setup-and-local

Passport js does the job very nicely, doing it without a library will just require you to reinvent the wheel.

+4
source

Source: https://habr.com/ru/post/1208339/


All Articles