I would like to send ID to my node server.
but I don't know how to get it server side. The Req is sent. console.log(req.body) returned empty...
Controller:
$scope.remove = function(id) {
var idstring = JSON.parse(id);
$http.delete('/contactlist/remove', {data: idstring}).then(function(response){
$scope.contactlist = $scope.contactlist.filter(function(contact){
return contact.id !== id;
})
});
};
Server:
app.delete('/contactlist/remove', function (req, res) {
console.log(req.body);
// connection.query('DELETE FROM contactlist WHERE id = ' + req.body.id, function (error, results, fields) {
res.json();
// });
});
