Powerbomb
Powerbomb

Reputation: 105

How to connect an express JS app to github API

I recently started using expressJS for the first time. I am having trouble connecting it to the github API so I can run commands to find comments and things like that on a given repo.

Any help would be awesome!

Thanks!

EDIT:

I have tried using: https://github.com/mikedeboer/node-github but I am not sure how to integrate this API with expressJS app

Here is an example of what I have so far that is not working correctly:

var GitHubApi = require("github");

var github = new GitHubApi({
    // required
    version: "3.0.0",
    // optional
    debug: true,
    protocol: "https",
    host: "github.com",
    pathPrefix: "/joyent/node", // for some GHEs
    timeout: 5000
});
github.gitdata.getCommit({
    // optional:
    // headers: {
    //     "cookie": "blahblah"
    // },
    user: "bnoordhuis",
    repo: "/commit",
    sha: "c30cc4e3a5ead3ca5b48e8eec445740775888ed8"
}, function(err, res) {
    console.log(JSON.stringify(res));
});

Upvotes: 1

Views: 2044

Answers (1)

Sandro Munda
Sandro Munda

Reputation: 41030

You can use a library that wraps the Github API. For example, node-github (100% covered).

Upvotes: 1

Related Questions