Giter VIP home page Giter VIP logo

githubber.js's Introduction

github.js

A node.js based github library for writing quick apps using the github api

Usage

With express.js 2.x

The below example is the way I personally use it, with the in built middleware for express. It will automatically perform the oAuth procedure and set up the API handler in the request object, making it all very easy to deal with.

The example configures the oAuth object, will authorise the user, and then list the repositories for the logged in user into the console.

var express = require('express');
var CONFIG = require('config');
var GitHub = require('github.js');
var cookieSecret = 'string';
var MemStore = express.session.MemoryStore;

var github = new GitHub.GitHub('CLIENT ID', 'CLIENT SECRET', ['ARRAY','OF','SCOPES'], 'CALLBACK URL');

var app = module.exports = express.createServer();

// Configuration

app.configure(function(){
  app.use(express.bodyParser());
  app.use(express.cookieParser());
  app.use(express.session({secret: cookieSecret, store: MemStore({
      reapInterval: 60000 * 10
    })}));
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(__dirname + '/public'));
});

// Routes
app.all('/', GitHub.Express(github), function(req, res){
  req.GitHub.repo.list(null, function(err, data){
    console.log(data);
  });
});

githubber.js's People

Contributors

lilmuckers avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

githubber.js's Issues

A huge fan

Great library. I couldn't recommend it anymore.

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.