Git Product home page Git Product logo

ghapi's Introduction

ghapi

Node.js proxy to the GitHub API to fetch and aggregate data about an organisation's repositories

⚠️ This project is discontinued, and not being actively maintained.

Howto

Clone and install dependencies:

git clone https://github.com/w3c/ghapi.git
cd ghapi/
npm install

Set up (you'll need a GitHub access token):

cp conf.json.example conf.json
edit conf.json # edit at least "organisation" and "token"

Run:

npm start
> [email protected] start /foo/bar/ghapi
> node --use_strict --throw-deprecation app
Listening on port 3000; visit http://localhost:3000/projects
GH API, token deadbeef: 4593/5000 (92%) requests available; resets in 58′36″
acme's 713 public projects:
bar, baz, foo, […] plugh, waldo, xyzzy
▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░▌  xyzzy

Wait until data about all repos is fetched (watch the progress bar), then visit http://localhost:3000/projects.

ghapi's People

Contributors

deniak avatar gbaudusseau avatar guibbs avatar tripu avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ghapi's Issues

Use octonode methods instead of get(URL)

URLs as literals are fragile. And I'm assuming that it'll be more efficient to use octonode's data structures instead of querying the GH API with a new request every time.

So, instead of:

client.get('/repos/w3c/' + projectName + '/commits', {}, function (err, status, body, headers) {
    
});
client.get('/repos/w3c/' + projectName + '/issues', {}, function (err, status, body, headers) {
    
});
client.get('/repos/w3c/' + projectName + '/contributors', {}, function (err, status, body, headers) {
    
});

do:

const repo = client.repo(`w3c/${projectName}`);
repo.commits((err, data, headers) => {
    
});
repo.issues((err, data, headers) => {
    
});
repo.contributors((err, data, headers) => {
    
});

TypeError: Cannot read property “commit” of undefined

$ npm start
⋮
TypeError: Cannot read property 'commit' of undefined
    at app.js:121:70
    at Client.errorHandle (node_modules/octonode/lib/octonode/client.js:196:14)
    at Request._callback (node_modules/octonode/lib/octonode/client.js:210:24)
    at Request.self.callback (node_modules/request/request.js:187:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (node_modules/request/request.js:1044:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
⋮

(Line numbers may differ from master; as I tested with some local changes.)

TypeError: Cannot read property “tag_name” of undefined

$ npm start
⋮
TypeError: Cannot read property 'tag_name' of undefined
    at app.js:124:68
    at Client.errorHandle (node_modules/octonode/lib/octonode/client.js:196:14)
    at Request._callback (node_modules/octonode/lib/octonode/client.js:210:24)
    at Request.self.callback (node_modules/request/request.js:187:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (node_modules/request/request.js:1044:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (node_modules/request/request.js:965:12)
⋮

Appears several times (once for each repo, it seems).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.