jubilee/server/foursquare.js

29 lines
770 B
JavaScript
Raw Normal View History

2018-02-23 10:36:49 +00:00
const logger = require('log4js').getLogger('FSQ');
const foursquare = require('node-foursquare-venues')('IXXFUGW3NC3DEVS2V5EU4NV4CL5E12AYGUPIR2D3U3B5DX4B', 'MZRIJDCEKUMVERA1OKVAIZI0TYAEBD3W2A2AGPTPI5TOLL1D', '20170801');
logger.level = 'debug';
function doGetFourSquareExplore(ll, limit = 3, section = 'topPicks') {
2018-02-23 10:36:49 +00:00
const [lat, long ] = ll.split(',');
return new Promise((resolve, reject) => {
const fsObj = {
'll': ll,
'section': section,
2018-02-23 10:36:49 +00:00
'v': '20170801',
'limit': limit,
'radius': 800
2018-02-23 10:36:49 +00:00
};
foursquare.venues.explore(fsObj, function(err, fsData) {
2018-03-20 22:18:36 +00:00
logger.debug(err);
2018-02-23 10:36:49 +00:00
if (err)
return reject(err);
else
return resolve(fsData);
});
});
}
module.exports = { doGetFourSquareExplore };