Skip to content

OS-Guild/gittp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ca00e8b · Feb 26, 2018

History

76 Commits
Feb 26, 2018
Jul 23, 2017
Apr 5, 2017
Apr 5, 2017
Jun 26, 2017
May 22, 2017
Apr 5, 2017
Jul 10, 2017
Jun 25, 2017
Jun 25, 2017
Apr 28, 2017
Apr 28, 2017
Jun 11, 2017
May 22, 2017

Repository files navigation

gittp

Expose a http api for any git repo

Usage

GET /api/content/{path}/{to}/{file} - Read the content of a file
example:

    get('http://yourhost/api/content/readme.md')
    .then(response => console.log(response))

    // {
    //   "isDirectory": false,
    //   "checksum": "5F251AC5FBC3DD0C0593296E5F9281239B8B660B503DD9234EBD49648831287B",
    //   "content": "hello world!"
    // }

GET /api/content/{path}/{to}/{directory} - Read the content of a directory
example:

    get('http://yourhost/api/content/readme.md')
    .then(response => console.log(response))

    // {
    //   "isDirectory": true,
    //   "content": ["readme.md", "license"]
    // }

POST /api/content/{path}/{to}/{file} - Set the content of a file, commit it to git and push to upstream. before invoking this action, you must read the file content and provide it's checksum as part of the request. You also need to provide a commit message. example:

post('http://yourhost/api/content/readme.md', {
    "checksum": "5F251AC5FBC3DD0C0593296E5F9281239B8B660B503DD9234EBD49648831287B",
    "commit_message": "update readme",
    "content": "hello world 2!"
})

PUT /api/content/{path}/{to}/{file} - Creates a new file at the given path

put('http://yourhost/api/content/new_readme.md', {
    "commit_message": "update readme",
    "content": "hello world 3!"
})