Files
koodiklinikka.fi-api/routes/members.js
2015-01-26 22:49:12 +02:00

29 lines
648 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 request = require('superagent');
var cache = require('apicache').middleware;
var config = require('../lib/config');
module.exports = function (app) {
/*
* POST /members
* Endpoint for fetching GitHub org members
*/
app.get('/members', cache('3 hours'), function(req, res, next) {
request
.get('https://api.github.com/orgs/koodiklinikka/public_members')
.set('Authorization', 'token ' + config.github.token)
.end(function(error, response){
if(error) {
return next(error);
}
req.apicacheGroup = response.body;
res.status(200).send(response.body);
});
});
};