diff --git a/app.js b/app.js index 6a50426361..ecbdc18fd5 100644 --- a/app.js +++ b/app.js @@ -397,6 +397,8 @@ app.get('/account/api', userController.getAccountAngular); */ app.get('/api/github', resourcesController.githubCalls); +app.get('/api/blogger', resourcesController.bloggerCalls); +app.get('/api/trello', resourcesController.trelloCalls); /** * Bonfire related routes diff --git a/controllers/resources.js b/controllers/resources.js index 6dc3b7e3ce..b6897857b0 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -150,6 +150,21 @@ module.exports = { }); }, + trelloCalls: function(req, res, next) { + request('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(err, status, trello) { + if (err) { return next(err); } + trello = (status && status.statusCode == 200) ? (JSON.parse(trello)) : "Can't connect to to Trello"; + res.end(JSON.stringify(trello)); + }); + }, + bloggerCalls: function(req, res, next) { + request('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (err, status, blog) { + if (err) { return next(err); } + blog = (status && status.statusCode == 200) ? JSON.parse(blog) : "Can't connect to Blogger"; + res.end(JSON.stringify(blog)); + }); + }, + about: function(req, res, next) { if (req.user) { if (!req.user.profile.picture || req.user.profile.picture === "https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png") {