Good afternoon, I write on Angular js express js (node) on anular I write
$scope.showAlert = function (user) { $scope.ctatus = true; var data = user; $scope.url = 'http://127.0.0.1:3000/api'+'?name='+user.lastName; $http({ method: $scope.method, url: $scope.url, cache: $templateCache }) .then(function(response) { $scope.status = response.status; $scope.data = response.data; console.log(response); }, function(response) { $scope.data = response.data || "Request failed"; $scope.status = response.status; }); }; on server
router.post('/api', function (req, res, netx) { res.json({name : 1}); console.log(req.query); }); All that is needed comes to the server, but the answer in the form of json is not returned and I cannot use the sent data in the application. How to make a normal integration of express and angular, well, at least the data from the server could normally pick up, without errors.
res.json({name : 1});onres.json(JSON.stringify({name : 1}));try to replace - Den