April 2020
Intermediate to advanced
716 pages
18h 55m
English
We need to store additional detail about each user to determine whether a user is an active seller or not. We will update the user model that we developed in Chapter 3, Building a Backend with MongoDB, Express, and Node, to add a seller value that will be set to false by default to represent regular users and can additionally be set to true to represent users who are also sellers. We will update the existing user schema to add this seller field with the following code:
mern-marketplace/server/models/user.model.js:
seller: { type: Boolean, default: false}
This seller value for each user must be sent to the client with the user details received on successful sign-in, so the view can be rendered accordingly to show information ...
Read now
Unlock full access