1.1.0 • Published 5 years ago

hubcrud v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Github API Router

Travis Build Status

This module produces Node.js express routes to interface with the GitHub API to treat a GitHub as if it were the a backend database. Specifically, this add CRUD routes to create, retrieve, update and delete files in a specified GitHub repository for which you have rights to do so. Note that this project is not associated with or officially endorsed by GitHub.com.

In order to use this, you need:

  1. Credentials on GitHub.com.

  2. A repository on GitHub on which you have read and right permissions.

  3. A personal access token that you have saved in a secrets.js file. This token will be read by githubrouter and passed to the GitHub api to access the CRUD routes. The secrets.js file should have the following format:

exports.accessToken="<PERSONAL_ACCESS_TOKEN>"

To use, simply import the router and assign it to a URL path:

Minimum working example

const githubRouter = require('hubcrud');
const app = require("express")();
//const cors = require("cors"); //As needed
const secrets = require("./secrets.js")

//app.use(cors()); //As needed

app.use("/", (req, res, next)=>{
  req.res.locals.accessToken = secrets.accessToken;
  next();  
})

app.use(githubRouter)

app.listen(3000, ()=>{console.log("Listening on port 3000")});

Note that this module requires an active Redis instance to work at the moment. Redis is used by this module to perform basic caching operations when retrieving the contents of files.

1.1.0

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago