Saving Your Commits With Git Hooks

I’ve been moving more and more towards using AngularJS as my JavaScript framework of chose recently. With this, the demand for creating/having an API to save and get data from has become a necessity.

Git-stats is a small Node.js app that I’ve been used to cut my teeth on creating API’s with Restify. In short it collects data from Git Hooks, saves it to a MongoDB database and makes it available via a restful API. This can be pretty useful if you want to create visualizations of your commits using data that isn’t available via the GitHub API.

The current API endpoints are as followed:

Commits for the hour

localhost:3010/:reponame/commits/hour  

Commits for the day

localhost:3010/:reponame/commits/day  

Commits for the week

localhost:3010/:reponame/commits/week  

You can also get all the commits for a time period by using all as the repository name

localhost:3010/all/commits/week  

For more information check the read-me on GitHub.

I’ve you’re looking for references on Restify I recommend Dom Udall’s blog post on creating a basic Node.js api with Restiy and Save.