Meteor生产应用程序上的HTTP返回错误为500,而本地主机上的HTTP返回错误为200
从今天开始,我就开始使用MeteorJs,并尝试使用HTTP包加载外部内容 这是我的服务器端代码:Meteor生产应用程序上的HTTP返回错误为500,而本地主机上的HTTP返回错误为200,http,meteor,Http,Meteor,从今天开始,我就开始使用MeteorJs,并尝试使用HTTP包加载外部内容 这是我的服务器端代码: if (Meteor.isServer) { Meteor.methods({ makeRequest: function (url) { return HTTP.call("GET", url); } }); } 在客户端,我尝试发出两个请求:一个直接来自客户端,另一个来自服务器方法: var url = "http://www.gutenberg.org/
if (Meteor.isServer) {
Meteor.methods({
makeRequest: function (url) {
return HTTP.call("GET", url);
}
});
}
在客户端,我尝试发出两个请求:一个直接来自客户端,另一个来自服务器方法:
var url = "http://www.gutenberg.org/cache/epub/6133/pg6133.txt";
// Make a request from the client
Meteor.http.call("GET", url, function(err, result) {
console.log("-- CLIENT SIDE --");
console.log("err : ", err);
console.log("result : ", result);
});
// Make a request from server
Meteor.call('makeRequest', url, function(err, result) {
console.log("-- SERVER SIDE --");
console.log("err : ", err);
console.log("result : ", result);
});
在本地主机上,服务器端工作正常。但在服务器上,我得到:
问题#1:如何轻松调试服务器
问题#2:对于此URL(),我在您第一次调用服务器时将其重定向到新URL()。这可能是导致错误的原因,但我如何处理它?调试服务器端的最佳方法是使用:
meteor日志
调试服务器端的最佳方法是使用:
流星日志