Skip to content

Instantly share code, notes, and snippets.

@garrilla
Last active August 29, 2015 14:06
Show Gist options
  • Save garrilla/2a8c5877440875434b0f to your computer and use it in GitHub Desktop.
Save garrilla/2a8c5877440875434b0f to your computer and use it in GitHub Desktop.
refactor Meteor.methods
/* path ./client/client.js */
Template.myTemplate.events({
'click input': function () {
Meteor.call('bar',function(error,result){console.log(!error ? result : error)});
}
})
/* path ./server/lib/foo/functions.js */
foo = function(){
console.log('called foo');
return 'oneMethod return'
}
/* path ./server/lib/bar/functions.js */
bar = function(){
console.log('called bar');
return 'bar return'
}
/* path ./server/methods.js */
Meteor.methods({
foo: function(){return foo()},
bar: function(){return bar()}
})
/* path ./server/lib/npm_require.js */
Path = Meteor.npmRequire('path');
FS = Meteor.npmRequire('fs');
Future = Meteor.npmRequire('fibers/future')
Fiber = Meteor.npmRequire('fibers')
Tedious = Meteor.npmRequire('tedious');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment