Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SomeService.placeSearch(options).then(function(results){
res.json(results);
})
var Promise = require('bluebird');
exports.placeSearch = function( options )
{
parameters = {
location : [ options.lat, options.lon ],
types: options.placeType
}
return new Promise(function(resolve,reject){
googlePlaces.placeSearch(
parameters,
function( error, response )
{
if (error)
{
sails.log.error('Place search failed due to error' + error.message );
throw error;
}
else
{
return resolve(response.results);
}
});
})
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment