Added foursquare API

This commit is contained in:
Sahat Yalkabov
2013-11-19 16:20:18 -05:00
parent 9d3da077a6
commit 7bef3acaf3
4 changed files with 45 additions and 3 deletions

View File

@ -1,3 +1,34 @@
var config = require('../config/config.json');
// API PROVIDERS SETUP
var foursquare = require('node-foursquare')({
secrets: {
clientId: config.foursquare.clientId,
clientSecret: config.foursquare.clientSecret,
redirectUrl: config.foursquare.callbackUrl
}
});
exports.apiBrowser = function(req, res) {
res.render('api');
};
};
exports.foursquare = function(req, res) {
res.render('api/foursquare', {
title: 'Foursquare API'
});
};
exports.foursquareCallback = function(req, res) {
foursquare.getAccessToken({
code: req.query.code
},
function(err, accessToken) {
if (err) {
res.send('An error was thrown: ' + err.message);
}
else {
// Save the accessToken and redirect.
}
});
});