PUT Method

Following this method and put this in main file api.js

app.put('/update', function(req, res){
    var sql  = 'UPDATE t_movie SET movie_title = ?, movie_rate = ? WHERE id_movie = "'+req.body.id_movie+'"';
    var body = [req.body.movie_title, req.body.movie_rate];
    con.query(sql, body, function(err){
       if(err){
           res.json({"Error": true, "Message": "Error execute sql"});
       } else {
           res.json({"Error": false, "Message": "Success"});
       }
    });
})

In Postman you select method to POST and type localhost:3000/update but, before you Send you must insert in body form. Look at picture below

Look! I changed Dunkirk which it have ID 1 and then i changed into Thor: Ragnarok with Rate 8

results matching ""

    No results matching ""