Created
June 2, 2016 03:51
-
-
Save gaboelnuevo/5038e47bc2e010a9f4c4e390f30e4e8d to your computer and use it in GitHub Desktop.
Loopback geopoint nerby place example
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
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