Created
April 20, 2023 12:11
-
-
Save trillionclues/6ffdf6df7202ba05dc1a39e3936f31b3 to your computer and use it in GitHub Desktop.
Gist to send and update specific node status by matching the Id in a database
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
// PUT ? UPDATE SPECIFIC NOTES | |
exports.dashboardUpdateNote = async (req, res) => { | |
try { | |
await Note.findOneAndUpdate( | |
{ _id: req.params.id }, | |
{ title: req.body.title, body: req.body.body, updatedAt: Date.now() } | |
).where({ user: req.user.id }) | |
res.redirect('/dashboard') | |
} catch (error) { | |
console.log(error) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment