I am trying to remove the password from the serial model of the JSON user.
For some reason, my controller is returning res.json({user: myUser}); , returns the full user, including password. Below is my user model. Thoughts?
# models/User.js var User = { attributes: { username: 'string', password: 'string' }, // Override toJSON method to remove password from API toJSON: function() { var obj = this.toObject(); // BELOW NOT WORKING delete obj.password; return obj; } }; module.exports = User;
source share