gh-status-get

1.0.0 • Public • Published

gh-status-get

NPM version Build Status Coverage Status Dependency Status devDependency Status

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

Use npm.

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.

Package Sidebar

Install

npm i gh-status-get

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • shinnn