DELETE Method
Following this method and put this in main file api.js
app.delete('/delete/:id_movie', function(req, res){
var sql = 'DELETE FROM t_movie WHERE id_movie = ?';
var id_movie = [req.params.id_movie];
con.query(sql, id_movie, function(err){
if(err){
res.json({"Error": true, "Message": "Error execute sql"});
} else {
res.json({"Error": false, "Message": "Success"});
}
});
});
In delete in add the parameter and usually parameter is ID. So, you type in localhost:3000/delete/1 and change method into DELETE. It means i will delete data with ID 1