pksunkara / octonode

github api v3 in nodejs
MIT License
1.19k stars 237 forks source link

Can octonode be used without Node.js? #271

Closed compumike08 closed 7 years ago

compumike08 commented 7 years ago

I'm developing a browser-based application using React and Redux, and I want to use the octonode library to handle interaction between my client-side code running in a browser and the GitHub API. While I realize octonode was designed to be used as part of a Node.js application, will the library still work correctly if it is run from within a browser as part of a JavaScript application instead of running within Node.js?

Just to clarify, while your README does explain how to use octonode with a web application, the explanation only discusses running octonode on a server-side Node.js application, with client-side code calling the server-side octonode. I want to run octonode directly within a browser-side application, with no server-side execution at all. Is this possible?

@pksunkara

NOTE: I realize that using the authentication options for octonode directly from a browser-side application can pose certain security risks and challenges, however those issues won't be relevant in my case because I've already implemented a different approach to authenticating to GitHub from my application (which does involve a server-side element for security reasons), so I wouldn't have to invoke octonode's web application authentication flow. My current authentication scheme will securely obtain an OAuth2 token, so I could simply instantiate an instance of octonode in the browser by passing that token the same way you would with a desktop application using ocotnode.

pksunkara commented 7 years ago

I guess you can use browserify or some package to bundle this library. But I am not planning to inherently support browser. Check this. https://github.com/k33g/gh3

compumike08 commented 7 years ago

@pksunkara: Thanks. I'm currently planning to bundle the library using Webpack. I've actually already looked into the link you provided, and unfortunately that library doesn't support commit statuses (which is a deal-breaker for my application). I've looked at a number of other JavaScript GitHub API libraries, and they all seem to either have a very limited pagination API which isn't really useful for my particular application, or they don't fully support viewing commit statuses, creating commit statuses, and the combined status endpoint (which I need).

Your library seems to be one of a very few that seems to support all of the GitHub API endpoints I need, as well as having a pagination API that allows you to fetch a specific page of data from the GitHub endpoint by page number (many other libraries are limited to getting the first page, last page, next page, and previous page; if you want to fetch page 5, then you have to first fetch the first page, and then call nextPage() four times).

I've also looked at:

As long as your library doesn't have any code in it that is specific to Node.js, then I think I should be fine using Webpack to bundle this. Thanks again.