-
-
Save robwormald/17af5b781c245bfd4809 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
SomeService.placeSearch(options).then(function(results){ | |
res.json(results); | |
}) |
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
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