Created
November 8, 2021 17:27
-
-
Save vmalep/ab3521401cb77f1fccb553e86608857e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
app.put('/api/movies/:id', (req, res) => { | |
const movieId = req.params.id | |
const moviePropsToUpdate = req.body | |
connection.promise().query( | |
'UPDATE movies SET ? WHERE id = ?', | |
[moviePropsToUpdate, movieId],) | |
.then(result=>res.status(200).send('Movie updated successfully 🎉')) | |
.catch(err=>{ | |
console.log(err) | |
res.status(500).send('Error updating a movie') | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment