I am assigning methods to a Meteor server like so:
In bootstrap.js
Meteor.startup(function () { Meteor.methods({ foo: function () { return 1; }, bar: function () { // QUESTION: HOW TO CALL Meteor.methods.foo return 1 + foo; } }); });
Meteor methods are functions that are written on the server side, but can be called from the client side. On the server side, we will create two simple methods. The first one will add 5 to our argument, while the second one will add 10.
Meteor. call() is typically used to call server-side methods from the client-side. However, you can also use Meteor. call() on the server-side to call another server-side function, though this is not recommended.
bindEnvironment(func, onException, _this) import { Meteor } from 'meteor/meteor' (meteor/dynamics_nodejs.js, line 114) Stores the current Meteor environment variables, and wraps the function to run with the environment variables restored. On the server, the function is wrapped within a fiber.
The same way you would call bar: Meteor.call("foo");
If you are on the server and do not specify a callback the method will run synchronously.
Docs for Meteor.call: http://docs.meteor.com/#meteor_call
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With