Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Users management in node js with express, mongodb as server database [closed]

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?

like image 291
Keren Avatar asked Dec 04 '14 10:12

Keren


1 Answers

I followed this tutorial. https://scotch.io/tutorials/easy-node-authentication-setup-and-local

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

like image 182
juunas Avatar answered Sep 29 '22 00:09

juunas