Skip to content

Instantly share code, notes, and snippets.

@gaboelnuevo
Created June 2, 2016 03:51
Show Gist options
  • Save gaboelnuevo/5038e47bc2e010a9f4c4e390f30e4e8d to your computer and use it in GitHub Desktop.
Save gaboelnuevo/5038e47bc2e010a9f4c4e390f30e4e8d to your computer and use it in GitHub Desktop.
Loopback geopoint nerby place example
module.exports = function(Place) {
Place.nearby = function(here,cb){
Place.find({where: {location: {near: here}}, limit:3}, function(err, nearbyPlaces) {
cb(null, nearbyPlaces);
});
};
Place.remoteMethod('nearby', {
accepts: [
{arg: 'here', type: 'GeoPoint', required: true, description: 'geo location (lat & lng)'}
],
returns: {arg: 'locations', root: true},
http: {path:'/nearby', verb: 'post'}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment