【发布时间】:2015-07-24 07:31:06
【问题描述】:
我有一个运行良好的 MEAN Stack Heroku 应用程序。但后来我添加了一个新功能:
app.get('/userCreated/:id', function(req, res) {
if (req.cookies.userCreated == req.params.id) {
res.send(true);
}
else {
res.send(false);
}
});
现在我在加载应用程序时收到 503(服务不可用)错误。有人知道为什么会这样吗?
我正在使用 Angular 和 $http.get() 来访问这个 Express.js 函数...
编辑:这是我正在调用服务器的客户端 Angular 代码:
var deferred = $q.defer();
function thisUserCreated(id) {
$http.get('/userCreated/' + id).success(function(data) {
deferred.resolve(data);
// returns boolean indicating whether the current user has the proper cookie
// saying this user created the given group
});
return deferred.promise;
};
【问题讨论】:
-
是
bn偶然或它是代码的一部分 -
糟糕。接得好。但这不是问题。还有其他想法吗?
-
你在服务器上使用的
port,在部署服务器上可以免费使用吗 -
同样,这个函数在 localhost 上表现正常,但在部署到 heroku 时会起作用
-
@Tushar 我相信。在添加此功能之前,此应用在 Heroku 上部署时运行正常
标签: angularjs node.js mongodb heroku express