Created
June 9, 2015 18:51
-
-
Save jgdovin/2a2da81f3420d07699c3 to your computer and use it in GitHub Desktop.
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
// Geocode server method | |
if (Meteor.isServer) { | |
Meteor.methods({ | |
geoCode: function(argument) { | |
var geoResult= function(argument, cb) { | |
geocodeSync({ | |
check(argument, String); | |
console.log(argument); | |
var geo = new GeoCoder(); | |
var result = geo.geocode(argument); | |
cb && cb(null, result); | |
}); | |
} | |
var geocodeSync=Meteor.wrapAsync(geoResult); | |
try { | |
var result = geoCodeSync(argument); | |
// do whatever you want with the result | |
console.log(result); | |
} catch (e) { | |
console.log(e); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment