Skip to content

Instantly share code, notes, and snippets.

@burkeholland
Last active August 9, 2017 15:10
Show Gist options
  • Save burkeholland/239c1c4a879efce03bce090a37a4d30c to your computer and use it in GitHub Desktop.
Save burkeholland/239c1c4a879efce03bce090a37a4d30c to your computer and use it in GitHub Desktop.
function update(req, res) {
const { id, name, saying } = req.body;
Hero.findOne({ id })
.then(hero => {
hero.name = name;
hero.saying = saying;
hero.save().then(res.json(hero)).catch(err => res.status(500).send(err));
})
.catch(err => {
res.status(500).send(err);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment