I have a production MEAN web project and I need to modify specific attribute after being created
app.post('/api/user',function(req,res){
var user = req.body;
console.log(req.body);
userModel
.create(user)
.then(
function(postObj){
var number = req.body.phone.substring(1);
res.json(200);
},function(error){
// res.sendStatus(400);
console.log(error)
res.json(error)
}
);});
Here I have to update specific attribute let's assume it's name gender and give it static value such as 'male' and I don't want to have a callback or use the return object
any help please...?
Aucun commentaire:
Enregistrer un commentaire