# express-healthcheck

> Super-simple healthcheck middleware for express

Latest version **0.1.0** (published 2016-03-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install express-healthcheck
pnpm add express-healthcheck
yarn add express-healthcheck
bun add express-healthcheck
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-03-01 |
| First published | 2015-02-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/express-healthcheck) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 53 |
| Author | Leonard Martin |
| Maintainers | lennym |

## Links

- npm: https://www.npmjs.com/package/express-healthcheck
- Repository: https://github.com/lennym/express-healthcheck
- Issues: https://github.com/lennym/express-healthcheck/issues
- npm.io page: https://npm.io/package/express-healthcheck

## Recent versions

- 0.1.0 (latest) — 2016-03-01
- 0.0.2 — 2015-02-04
- 0.0.1 — 2015-02-03
- 0.0.0 — 2015-02-03

## README

# express-healthcheck
Super-simple healthcheck middleware for express


## Installation

```
npm install express-healthcheck
```

## Usage

```
app.use('/healthcheck', require('express-healthcheck')());
```

This will respond with a JSON payload of `{ "uptime": [uptime in seconds] }` and a 200 status code.

The healthy response can be customised by passing in a custom `healthy` method.

```
app.use('/healthcheck', require('express-healthcheck')({
    healthy: function () {
        return { everything: 'is ok' };
    }
}));
```

You can optionally provide a test method which will be executed to establish the health of the application.

This function can either throw, return an error, or call a callback with an error. Functions with an arity of 0 will expect a return, functions with an arity of 1 will expect a callback.

```
app.use('/healthcheck', require('express-healthcheck')({
    test: function () {
        throw new Error('Application is not running');
    }
}));
```

```
app.use('/healthcheck', require('express-healthcheck')({
    test: function () {
        return { state: 'unhealthy' };
    }
}));
```

```
app.use('/healthcheck', require('express-healthcheck')({
    test: function (callback) {
        callback({ state: 'unhealthy' });
    }
}));
```

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