Skip to content

Instantly share code, notes, and snippets.

@vmalep
Created November 10, 2021 07:32
Show Gist options
  • Save vmalep/db22caffd7dab54deed3dfc5fc614b39 to your computer and use it in GitHub Desktop.
Save vmalep/db22caffd7dab54deed3dfc5fc614b39 to your computer and use it in GitHub Desktop.
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