Created
June 9, 2017 22:41
-
-
Save oprearocks/420dd19561a381e3466828207da87f8c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.put('/user/:userId', (req, res) => { | |
User.findByIdAndUpdate(req.params.userId, $set: req.body.data, (updateFailedError, user) => { | |
if (updateFailedError) { | |
res | |
.status(500) | |
.json({ | |
errors: [updateFailedError] | |
}); | |
} | |
res | |
.status(200) | |
.json({ | |
success: true | |
data: { | |
user | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment