Created
November 10, 2021 07:32
-
-
Save vmalep/db22caffd7dab54deed3dfc5fc614b39 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.delete('/api/movies/:id', (req, res) => { | |
const movieId = req.params.id; | |
connection.promise().query( | |
'DELETE FROM movies WHERE id = ?', | |
[movieId],) | |
.then(result=>res.status(200).send('🎉 Movie deleted!')) | |
.catch(err=>{ | |
console.log(err) | |
res.status(500).send('😱 Error deleting an movie') | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment