Skip to content

Instantly share code, notes, and snippets.

@jgdovin
Created June 9, 2015 19:17
Show Gist options
  • Save jgdovin/21994e43f600a1fb84cb to your computer and use it in GitHub Desktop.
Save jgdovin/21994e43f600a1fb84cb to your computer and use it in GitHub Desktop.
// Geocode server method
if (Meteor.isServer) {
Meteor.methods({
geoCode: function(argument) {
var geoResult= function(argument, cb) {
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