【发布时间】:2013-11-14 01:30:46
【问题描述】:
所以我有一个控制器内的客户端:
$scope.authenticate = function() {
var creds = JSON.stringify({email: this.email, password: this.password});
$http.post('/authenticate', creds).
success(function(data, status, headers, config) {
// etc
}).
error(function(data, status, headers, config) {
// etc
});
};
在服务器端:
app.post('/authenticate', function(req, res) {
console.log("Unserialized request: " + JSON.parse(req));
});
但是当我尝试解析请求时出现错误。我不知道为什么。有什么想法吗?
【问题讨论】:
-
您可能不想解析请求对象本身。您想解析正文中的字段(req.body 或 req.body.whatever)
标签: javascript node.js angularjs express