Git Product home page Git Product logo

git-rest-api's Introduction

CI CD
Build Status Build Status
  • Javascript SDK https://www.npmjs.com/package/git-rest-api-sdk

Overview

This project is webserver that can be used as a docker container to provide a proxy/rest api on top of git repository. One of the goal of this is to work around github api rate limiting. The api tries to looks as similar to the github rest api.

Following apis are supported for now:

  • Commits
    • List
    • Get
    • Compare
  • Branch
    • List
  • Files
    • List
    • Get content

Quick start

docker run -d -p 3009:3009 azuredevx/git-rest-api
sleep 3 # optional: wait for container to start
curl localhost:3009/repos/github.com%2Foctocat%2FHello-World/contents/

Deploy with docker

Image: azuredevx/git-rest-api

You can configure various options using environemnt variables. See https://github.com/Azure/git-rest-api/blob/master/src/config/schema.ts

Note: There is no authentication layer yet from your service to the docker image. You should most likely use in in a contained environment(Inside a VNet or kubernetes cluster for example)

Use the API

  • Using the Javascript sdk A javascript sdk is always included and up to date with the latest version of the service.
npm install --save git-rest-api-sdk
  • Use rest api

There is a /swagger endpoint which serve the swagger UI with all the api you can use and help you figure out the available/required params.

To authenticate against the repo if its not public you have 2 options:

  • x-authorization: This needs to be in a Basic auth format(Basic base64(usename:password)). Check with the git server how you can authenticate.
  • x-github-token: This is an helper for authnetication against github api. The basic header will be generated automatically

Develop

  1. Install dependencies
npm install
  1. Run
npm start           # To run once
npm start:watch     # To run and restart when there is a change

Run in vscode

Instead of npm start run npm build:watch and in vscode press F5

Windows

  • Long path issue. libgit2(library behind nodegit) doesn't support windows long path feature. Which means some repo with long reference might not work on windows. You can test with other simpler repos on windows. You should however not use this in production on windows.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

git-rest-api's People

Contributors

billytrend avatar dependabot[bot] avatar microsoftopensource avatar msftgits avatar raych1 avatar timotheeguerin avatar zhenglaizhang 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.