Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oprearocks/420dd19561a381e3466828207da87f8c to your computer and use it in GitHub Desktop.
Save oprearocks/420dd19561a381e3466828207da87f8c to your computer and use it in GitHub Desktop.
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