DEV Community

Discussion on: How To Build Rest API With NodeJS, Express, and MySQL

Collapse
 
andylink profile image
andylink

Ah, typical, posted for help and worked it out shortly afterwards.

Wasn't aware of the es6 spread operator, altering as per below removes those items from being sent.

getCurrentUser = async (req, res, next) => {
const { password, first_name, last_name...userWithLessInfo } = req.currentUser;
res.send(userWithLessInfo);
};