Last active
August 29, 2015 14:06
-
-
Save garrilla/2a8c5877440875434b0f to your computer and use it in GitHub Desktop.
refactor Meteor.methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* path ./client/client.js */ | |
Template.myTemplate.events({ | |
'click input': function () { | |
Meteor.call('bar',function(error,result){console.log(!error ? result : error)}); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* path ./server/methods.js */ | |
Meteor.methods({ | |
foo: function(){return foo()}, | |
bar: function(){return bar()} | |
}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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