Skip to content

Commit

Permalink
Merge pull request #104 from bcdxn/master
Browse files Browse the repository at this point in the history
Add health checks
  • Loading branch information
RafalWilinski committed Sep 18, 2018
2 parents f15d2c1 + 6699925 commit 25e8100
Show file tree
Hide file tree
Showing 11 changed files with 5,877 additions and 37 deletions.
22 changes: 22 additions & 0 deletions README.md
Expand Up @@ -62,10 +62,32 @@ chartVisibility: {
rps: true,
statusCodes: true
},
healthChecks: [],
ignoreStartsWith: '/admin'

```

## Health Checks

You can add a series of health checks to the configuration that will appear below the other stats. The health check will be considered successful if the endpoint returns a 200 status code.

```javascript
// config
healthChecks: [{
protocol: 'http',
host: 'localhost'
path: '/admin/health/ex1',
port: '3000'
}, {
protocol: 'http',
host: 'localhost'
path: '/admin/health/ex2',
port: '3000'
}]
```

![Health Checks](https://i.imgur.com/6tY4OhA.png "Health Checks")

## Securing endpoint

The HTML page handler is exposed as a `pageRoute` property on the main
Expand Down
16 changes: 16 additions & 0 deletions examples/index.js
Expand Up @@ -21,6 +21,22 @@ app.use(
// Pass socket.io instance port down to config.
// Use only if you're passing your own instance.
// port: socketIoPort,
healthChecks: [
{
protocol: 'http',
host: 'localhost',
port: 3000,
path: '/admin/health/ex1',
headers: {},
},
{
protocol: 'http',
host: 'localhost',
port: 3000,
path: '/return-status/200',
headers: {},
},
],
}),
);
app.use(require('express-favicon-short-circuit'));
Expand Down

0 comments on commit 25e8100

Please sign in to comment.