2013-02-02 128 views

回答

1

您可以使用Meteor.methods。只要將代碼放在一個名爲server/的文件夾中,只要將它們包含在服務器上即可

server/admin.js

Meteor.methods({ 
    foo: function (arg1, arg2) { 
    // confirm that the user is an admin 
    if (! this.user.isAdmin) 
     throw new Meteor.Error(401, "You are not authorized to perform this action"); 
    // perform task 
    return "some return value"; 
    } 
});