简体   繁体   English

Meteor Call返回404 Method Not Found

[英]Meteor Call returning 404 Method Not Found

        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');
            }
        });

This is my call Meteor call on the client. 这是我在客户端调用Meteor调用。

and I've got this in the server. 我在服务器上有这个。

Meteor.methods({
    create_question: function(question_title, question_content) {
// does stuff   
    },

});

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. 我在服务器文件夹中有Meteor.methods,在客户端文件夹中有调用。

The method create_question should be defined on both the client and the server. 该方法create_question应在客户端和服务器上定义。

You can use this.isSimulation to figure-out whether the Method is being executed on the server or the client (as a stub). 您可以使用this.isSimulation来确定是在服务器上还是在客户端上执行Method(作为存根)。

It may be that another method being called within your create_question method isn't defined. 可能是您的create_question方法中调用的另一个方法未定义。

That was my problem, but the error message still says that the create_question method is the one that's not defined. 这是我的问题,但错误消息仍然表示create_question方法是create_question方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM