Wednesday 27 September 2017

Need help with NodeJS and Handlebars

Good day Reddit-readers For about 1-2 days I've been looking for a solution to a problem i approached...i want to see only people in a list with the same name as the person that is logged in. For example you login with "Alex" Then i'd like to see every user with the name "Alex" in a list in Handlebars /****THIS IS THE ROUTER TO THE OVERVIEW*******/ router.get('/overview', loggedIn, function (req, res, next) { var resultArray = []; mongo.connect(url, function (err, db) { assert.equal(null, err); var cursor = db.collection('users').find(); cursor.forEach(function (doc, err) { assert.equal(null, err); resultArray.push(doc); }, function () { db.close(); res.render('overview', {users: resultArray}); }); }); With this i can see all users and in handlebars i have /*type 1 means he has the permission to see this if his type is 1*/

Unauthorized!

I was thinking about something like So it would show me every user with the same name...

Submitted September 27, 2017 at 12:55PM by Paindeva

No comments:

Post a Comment