流星调用返回 404 方法未找到 [英] Meteor Call returning 404 Method Not Found
本文介绍了流星调用返回 404 方法未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Meteor.call('create_question', title, content, function(error, result) {
console.log('create_question error ' + error);
console.log('create_question result ' + result);
if (error) {
} else {
console.log('Your question was submitted');
}
});
这是我在客户端上调用 Meteor 调用.
This is my call Meteor call on the client.
我已经在服务器中找到了.
and I've got this in the server.
Meteor.methods({
create_question: function(question_title, question_content) {
// does stuff
},
});
但由于某种原因,我一直在找不到方法.有谁知道怎么了?我在服务器文件夹中有 Meteor.methods,在客户端文件夹中有调用.
But for some reason I keep getting Method is not found. Anyone know what's wrong? I've got the Meteor.methods in the server folder and the call in the client folder.
推荐答案
create_question
方法应该在客户端和服务器端都定义.
The method create_question
should be defined on both the client and the server.
您可以使用 this.isSimulation
来确定方法正在服务器或客户端上执行(作为存根).
You can use this.isSimulation
to figure-out whether the Method is being executed on the server or the client (as a stub).
这篇关于流星调用返回 404 方法未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文