Created
September 14, 2020 08:05
-
-
Save alyson-b69/770de3fda2afdff6533ab46defeaefca to your computer and use it in GitHub Desktop.
EXPRESS 5 - Méthode DELETE
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
app.delete("/api/movies/:id", (req, res) => { | |
const idMovie = req.params.id; | |
connection.query("DELETE FROM movie WHERE id = ?", [idMovie], (err) => { | |
if (err) { | |
console.log(err); | |
res.status(500).send("Erreur lors de la suppression d'un film"); | |
} else { | |
res.sendStatus(200); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment