npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

git-rest-api

v0.2.8

Published

A library providing a restful Git API mimicking as most as possible the old good git

Downloads

38

Readme

GIT REST API

Build Status

The aim of the project is to provide a restful Git API that mimics as most as possible the old good git.

For example, in order to commit a change in shell you should do:

$ mkdir new-project
$ cd new-project
$ git init
$ git add file.c
$ git commit -m 'A commit message'
$ git add file.c
$ git commit -m 'A second commit message'
$ git show HEAD~:file.c

In case of git-rest-api you should do:

POST /init
  { "repo": "new-project" }
POST /repo/new-project/tree/file.c
POST /repo/new-project/commit
  { "message": "A commit message" }
POST /repo/new-project/tree/file.c
POST /repo/new-project/commit
  { "message": "A second commit message" }
GET  /repo/new-project/show/file.c?rev=HEAD~

Install

In your project install git-rest-api and express:

$ npm install git-rest-api
$ npm install express

Environment variables

The following environment variables are supported:

  • PORT: port to serve at, default is 8080
  • PREFIX: string prefix to serve repositories at, i.e. http://localhost:[port]/[prefix]/repo/:repo/tree/:path
  • TMPDIR: name of temporary directory to use to cache repositories
  • LOGLEVEL: log level for winston logger. Default is error

Example servers

Example 1: A simple example of a server running git-rest-api:

var app = require('express')(),
    git = require('git-rest-api');

git.init(app, { installMiddleware: true }).then(function () {
  app.listen(8080);
  console.log('Listening on', 8080);
});

Example 2: All actions on repositories are specific to the client session. To share repositories between sessions/cookies, pass an existing path to workDir in the init config, e.g.

mkdirp = require('mkdirp');
var WRKDIR = './wrk-test-git';
mkdirp.sync(WRKDIR, 0755);
git.init(app, { workDir: WRKDIR }).then(function () {
  ...
});

Example 3: For a dockerized version, check docker-node-git-rest-api

Example clients

Testing

  1. For direct testing on your local machine: npm install followed by npm test
  2. For using the provided vagrant virtual environment: cd vagrant followed by make
  3. To increase verbosity: export LOGLEVEL=info

API