Created
June 9, 2015 19:17
-
-
Save jgdovin/21994e43f600a1fb84cb to your computer and use it in GitHub Desktop.
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
// 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