Created
August 1, 2015 10:27
-
-
Save izumskee/6c56d3e0747fcc37173b to your computer and use it in GitHub Desktop.
Use Async Functions With Meteor
This file contains hidden or 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
var GithubAPI = Meteor.require('github'); | |
var ghapi = new GithubAPI({version: "3.0.0"}); | |
function getUserProfile(req, callback) { | |
ghapi.user.getFrom(req, callback); | |
} | |
var wrappedGetProfile = Meteor._wrapAsync(getUserProfile); | |
Meteor.methods({ | |
getProfile: function(username) { | |
return wrappedGetProfile({user: username}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment