# healthkit

> Health check utility library

Latest version **0.1.3** (published 2016-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install healthkit
pnpm add healthkit
yarn add healthkit
bun add healthkit
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2016-08-25 |
| First published | 2016-05-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alex Indigo |
| Maintainers | alexindigo |
| Keywords | health, check, http, file, haproxy, library |

## Links

- npm: https://www.npmjs.com/package/healthkit
- Repository: https://github.com/alexindigo/healthkit
- Homepage: https://github.com/alexindigo/healthkit#readme
- Issues: https://github.com/alexindigo/healthkit/issues
- npm.io page: https://npm.io/package/healthkit

## Dependencies (3)

- [deeply](https://npm.io/package/deeply.md) ^2.0.3
- [asynckit](https://npm.io/package/asynckit.md) ^0.4.0
- [precise-typeof](https://npm.io/package/precise-typeof.md) ^1.0.2

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.1.3 (latest) — 2016-08-25
- 0.1.2 — 2016-07-22
- 0.1.1 — 2016-07-18
- 0.1.0 — 2016-07-18
- 0.0.0 — 2016-05-10

## README

# healthkit [![NPM Module](https://img.shields.io/npm/v/healthkit.svg?style=flat)](https://www.npmjs.com/package/healthkit)

Health check utility library

[![Linux Build](https://img.shields.io/travis/alexindigo/healthkit/v0.1.3.svg?label=linux:0.12-6.x&style=flat)](https://travis-ci.org/alexindigo/healthkit)
[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/healthkit/v0.1.3.svg?label=windows:0.12-6.x&style=flat)](https://ci.appveyor.com/project/alexindigo/healthkit)

[![Coverage Status](https://img.shields.io/coveralls/alexindigo/healthkit/v0.1.3.svg?label=code+coverage&style=flat)](https://coveralls.io/github/alexindigo/healthkit?branch=master)
[![Dependency Status](https://img.shields.io/david/alexindigo/healthkit/v0.1.3.svg?style=flat)](https://david-dm.org/alexindigo/healthkit)
[![bitHound Overall Score](https://www.bithound.io/github/alexindigo/healthkit/badges/score.svg)](https://www.bithound.io/github/alexindigo/healthkit)

<!-- [![Readme](https://img.shields.io/badge/readme-tested-brightgreen.svg?style=flat)](https://www.npmjs.com/package/reamde) -->

## Install

```
npm install --save healthkit
```

## Example

Checks for signal file and if it exists responds with `404` code
(to signal to load balancer to drain incoming requests),
if signal file doesn't exist, checks for upstream endpoint,
and returns `200` if endpoint is reachable and responds with successful http response.
Otherwise returns `500` code when all previous checks fail.

```javascript
var healthkit = require('healthkit');

var myAppChecks = [
	// first check for lets-drain signal file
  {
    status: 404, // respond with 404 if file present
    file: '/etc/consul/test_file.exists'
  },
  // second check for underlying endpoint
  // proceeded here if previous check failed
  {
    status: 200, // respond with 200 if endpoint responds with successful code (200-299)
    http: 'http://simple.url/endpoint'
  },
  // third (empty, default) check
  // proceeded here if previous check failed
  {
    status: 500 // everything failed, fail the health check
  }
];

// Express handler
app.get('/health', function(req, res)
{
  healthkit(myAppChecks, function(code, result)
  {
    res.status(code).send(result);
  });
});

```

## Want to Know More?

More examples can be found in [test folder](test/).

Or open an [issue](https://github.com/alexindigo/healthkit/issues) with questions and/or suggestions.

## License

HealthKit is released under the [MIT](LICENSE) license.

---
_Source: https://npm.io/package/healthkit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
