Skip to content

Instantly share code, notes, and snippets.

@zpv
Last active July 22, 2018 23:12
Show Gist options
  • Save zpv/e06708027d796fd6b35c63f437a3357f to your computer and use it in GitHub Desktop.
Save zpv/e06708027d796fd6b35c63f437a3357f to your computer and use it in GitHub Desktop.
// GitHub Middlelayer
const app = require('express')();
const request = require('request');
const github_api = "https://api.github.com";
const key = 'OUATH_TOKEN';
const auth_header = '"Authorization: token OAUTH-TOKEN"';
app.get('*', (req, res, next) => {
var options = {
url: github_api + req.path,
headers: {
'Authorization': 'token ' + key,
'User-Agent': 'node.js'
}
};
request(options, (err, resp, body) => {
res.send(JSON.parse(body));
})
});
app.listen(3000, () => console.log('Example app listening on port 3000!'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment