# loopback-status

> Health check helper for loopback datasources

Latest version **1.1.5** (published 2020-09-21) · 0 weekly downloads

## Install

```sh
npm install loopback-status
pnpm add loopback-status
yarn add loopback-status
bun add loopback-status
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2020-09-21 |
| First published | 2017-12-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 25.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Starchup Inc |
| Maintainers | glesage, eahenke |
| Keywords | starchup |

## Links

- npm: https://www.npmjs.com/package/loopback-status
- Repository: https://github.com/Starchup/loopback-status
- Homepage: https://github.com/Starchup/loopback-status#readme
- Issues: https://github.com/Starchup/loopback-status/issues
- npm.io page: https://npm.io/package/loopback-status

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.1.5 (latest) — 2020-09-21
- 1.1.4 — 2020-09-15
- 1.1.3 — 2020-09-14
- 1.1.2 — 2019-12-18
- 1.1.1 — 2019-12-18
- 1.1.0 — 2019-12-18
- 1.0.0 — 2017-12-01

## README

# loopback-status
Health check helper for loopback datasources.

### Description

1. Verify that data is accessible by doing Count queries to the passed in models
2. Cache the response of those counts for a predefined amount of time.
3. Make sure the Count queries execute under a predefined amount of time

### Initialization

```
var status = require('loopback-status');
var Status = new status(
{
    models: [app.models.YouModel],
    okStatus: 200,      // Response code to return when all is well
    nokStatus: 503,     // Response code to return when any DB requests fail
    slowStatus: 408,    // Response code to return when DB response takes too long
    cacheTimer: 30000,  // How long to preserve cached result for
    dbTimeout: 10000    // how long to wait before DB results come back
});
```


### Basic use

In the boot directory of your loopback app add a new file:
```
var status = require('loopback-status');

// Install a `/` route that returns server status
module.exports = function (app)
{
    var Status = new status(
    {
        models: [app.models.YourModel1, app.models.YourModel2]
    });

    var router = app.loopback.Router();
    router.get('/', Status.health);
    app.use(router);
};
```

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