gh-status-get
v1.0.0
Published
Create a GET request to the Github Status API
Downloads
8
Maintainers
Readme
gh-status-get
A Node module to create a GET request to the Github Status API
const ghStatusGet = require('gh-status-get');
ghStatusGet('api/status.json').then(({body}) => {
body; //=> {status: 'good', last_updated: '2016-05-25T11:15:24Z'}
});
Installation
npm install gh-status-get
API
const ghStatusGet = require('gh-status-get');
ghStatusGet(url [, options])
url: String
(a "path" part of the Github Status API URL, for example api.json
and api/status.json
)
options: Object
(Request
options, except for method
option)
Return: Object
(Promise
instance)
It makes a GET
request to the Github Status API and returns a promise.
When the API request finishes successfully, the promise will be fulfilled with the http.IncomingMessage
object with the additional body
property that contains a JSON object of the API response.
When the API request fails, the promise will be rejected with an error.
const ghStatusGet = require('gh-status-get');
ghStatusGet('api/status.json').then(response => {
response.body.status; //=> 'good'
response.statusCode; //=> 200
});
License
Copyright (c) 2016 Shinnosuke Watanabe
Licensed under the MIT License.