jubilee-server/server/foursquare.js
Martin Donnelly 84365f816d init
2021-11-29 15:14:46 +00:00

35 lines
917 B
JavaScript

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', query = '') {
const [lat, long ] = ll.split(',');
console.log('>> query', query);
return new Promise((resolve, reject) => {
const fsObj = {
'll': ll,
'v': '20170801',
'limit': limit,
'radius': 800
};
if (query === '' )
fsObj.section = section;
else
fsObj.query = query;
console.log('>> fsObj', fsObj);
foursquare.venues.explore(fsObj, function(err, fsData) {
logger.error(err);
if (err)
return reject(err);
else
return resolve(fsData);
});
});
}
module.exports = { doGetFourSquareExplore };