Files
koodiklinikka.fi-api/routes/feeds.js
2015-02-26 22:39:23 +02:00

24 lines
606 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
var cache = require('apicache').middleware;
var Promise = require('bluebird');
var twitter = require('../services/twitter');
var github = require('../services/github');
module.exports = function (app) {
/*
* GET /feeds
* Endpoint for fetching different information feeds (Twitter, GitHub etc.)
*/
app.get('/feeds', cache('10 minutes'), function(req, res, next) {
Promise.props({
twitter: twitter.getTweets(40),
github: github.getEvents(40)
}).then(function(data) {
res.status(200).send(data);
}, function(err) {
next(err);
});
});
};