gh-post
A Node module to create a POST
request to the Github API
const ghPost = require('gh-post');
ghPost('gists', {
headers: {
'user-agent': 'your application name'
},
token: 'your access token',
body: {
files: {
'file1.txt': {
content: 'Hi'
}
}
}
}).then(response => {
response.headers.status; //=> '201 Created'
response.headers.location; //=> for example 'https://api.github.com/gists/6ba9f11f4e1acf13645'
});
Installation
npm install gh-post
API
const ghPost = require('gh-post');
ghPost(url [, options])
url: String
("path" part of a Github API URL)
options: Object
(gh-get
options)
Return: Object
(Promise
instance)
Almost the same as gh-get, except that the method
option defaults to 'POST'
and unchangable.
License
Copyright (c) 2015 Shinnosuke Watanabe
Licensed under the MIT License.