Skip to content

Instantly share code, notes, and snippets.

@robwormald
Forked from gregorypierce/gist:95ba27df6f2db207b519
Last active August 29, 2015 14:13
Show Gist options
  • Save robwormald/17af5b781c245bfd4809 to your computer and use it in GitHub Desktop.
Save robwormald/17af5b781c245bfd4809 to your computer and use it in GitHub Desktop.
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