madhums / node-express-mongoose-demo

A simple demo app using node and mongodb for beginners (with docker)

Home Page:https://nodejs-express-demo.fly.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

req.user problem

the-einstein opened this issue · comments

I wanted to add types to user as admin or just user. but I am not realizing where you gave these params

{
 name: 'name ',
  username: 'username ',
  _id: id
}

i want to add new param here as role, but anytime I change the page the req.user params are also hanged and got got only these three params.
I want to have
{
name: 'name',
username: 'username',
role: "role",
_id: id
}

you need to edit user schema from user model and add role in its's schema and give it a default value as user

you need to edit user schema from user model and add role in its's schema and give it a default value as user

I am sorry but this won't help in my condition