Coder Social home page Coder Social logo

node-repo-github's Introduction

Fetching Github Repo info with Node.js

A very simple node.js module for fetching information about a Github Repo. This was developed as a helper to a project of mine, and should probably be fixed up and made more robust.

Installing

Clone the repo

cd ~/my/node-project/
git clone git://github.com/mikaelbr/node-repo-github.git

You'll now have a folder called node-repo-github/ in your node-project/. You could rename directory and or move it, if you'd like.

How to use

Firstly you need to require the module. Given the structure above this would be

var githubrepo = require('./node-repo-github/githubrepo.js');

Methods

Now you're ready to use it. As per now, this module only has one method; open. This finds a repo based on user and repo name.


githubrepo.open(username, repo, callback)

Parameters

  1. username – The username of the repo owner
  2. repo – Full repository name
  3. callback – Function to be invoked once there's data

Callback

The callback should look like this

function (err, data) {}

Where err is the error notice and data is the Github response.

Example

// Require module. Edit path to match your structure
var githubrepo = require("../githubrepo.js");

// Look for repo and set callback to log data found
githubrepo.open("mikaelbr", "node-repo-github", function (err, data) {
	if (err) throw err;

	// Log results
	console.log(data);
});

node-repo-github's People

Contributors

mikaelbr avatar

Stargazers

node-migrator-bot avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

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.