Skip to content

Instantly share code, notes, and snippets.

View akorchev's full-sized avatar

Atanas Korchev akorchev

View GitHub Profile
function update(req, res) {
const { id, name, saying } = req.body;
Hero.findOne({ id }, (err, hero) => {
if (err) {
res.status(500).send(err);
} else if (!hero) {
res.status(500).send("Hero not found");
} else {
hero.name = name;