Created
August 9, 2017 15:14
-
-
Save akorchev/988b951cbcf962d648389b52c4e5b0a8 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
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); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment