POST Method
Following this method and put this in main file api.js
app.post('/insert', function(req, res){
var sql = 'INSERT INTO t_movie (movie_title, movie_rate) VALUES (?, ?)';
var body = [req.body.movie_title, req.body.movie_rate];
con.query(sql, body, function(err){
if(err){
res.json({"Error": true, "Message": "SQL Error"});
} else {
res.json({"Error": false, "Message": "Success"})
}
});
})
In Postman you select method to POST and type localhost:3000/insert
but, before you Send you must insert in body form. Look at picture below
I insert new movie with Movie Title IT and Movie Rate 9