1

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));
});
5
  • I have tired using github.com/mikedeboer/node-github but i am not sure how it integrates with expressJS app. Commented Mar 18, 2014 at 20:17
  • It doesn't integrate with ExpressJS. You need to write your own code in an Express route handler to call their functions. Commented Mar 18, 2014 at 20:35
  • Okay, that makes a lot more sense. Thanks! Commented Mar 18, 2014 at 20:39
  • What problem are you having? Commented Mar 18, 2014 at 20:54
  • Specifically the above code is giving me the error null bnoordhuis. I am trying to use expressjs app to get commit data from git hub. So i just picked a random github repo and picked a random person using that repo. Commented Mar 18, 2014 at 20:57

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

I came across this myself. The only problem is that the documentation doesn't include integration with expressJS, only how to use the api in javascript. I am not sure how the expressJS app and the API interact. Maybe I am over thinking this...
You can use any library with Express.js. There's absolutely no problem. Express allows you a lot of freedom about your code structure, third-party libraries, etc.
Awesome! Would you happen to have an example of this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.