I want to delete all data in my database by a single click.but it gives "DELETE http://localhost:8080/api/deleteAll 404 (Not Found)".
can anyone help with this?
Below codes are my attempt.
Controller
$scope.deleteAllData = function () {
Event.deleteAll()
.success(function(){
console.log("All Deleted");
})
.error(function (error) {
$scope.status = 'Unable to load event data: ';
});
};
Service
deleteAll : function() {
return $http.delete('/api/deleteAll');
},
Route
app.delete('/api/deleteAll', function(req, res) {
filesReadUploads.remove({},function(err) {
if (err) {
console.log(err)
} else {
res.end('success');
}
});
});
Thanks
via MSKP
No comments:
Post a Comment