Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including gothub with all npm packages installed. Try it out:

var gothub = require("gothub")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

gothub v1.0.2

A convenience wrapper for `got` to interact with the GitHub API (very similar to gh-got).

gothub

A convenience wrapper for got to interact with the GitHub API, very similar to gh-got.

Install

$ npm install --save gothub

Usage

With gh-got, you do this:

var ghGot = require('gh-got');

ghGot('users/sindresorhus', {token: 'foo'}, function(err, data){
  console.log(data.login); //=> 'sindresorhus'
});

With gothub, you can do this:

var gothub = require('gothub');

var github = new gothub({ token:'foo', endpoint:'https://github-enterprise.example.com/api/v3' });

github.get('users/sindresorhus', function(err, data){
  console.log(data.login); //=> 'sindresorhus'
});

gothub moves the token and endpoint options into the constructor.


Much of the work was shamelessly borrowed from Sindre Sorhus - I simply rearranged some things.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free