keystone-healthchecks
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "keystone-healthchecks", | ||
"description": "Healthchecks Framework for KeystoneJS (or any Express app)", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"main": "src/index.js", | ||
@@ -24,8 +24,11 @@ "license": "MIT", | ||
"devDependencies": { | ||
"eslint": "^3.15.0", | ||
"eslint-config-keystone": "^3.0.0", | ||
"express": "^4.14.0", | ||
"mocha": "3.2.0", | ||
"supertest": "^2.0.1" | ||
"supertest": "^3.0.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha 'test/**/*.test.js'" | ||
"test": "mocha 'test/**/*.test.js'", | ||
"lint": "eslint ." | ||
}, | ||
@@ -32,0 +35,0 @@ "keywords": [ |
@@ -57,4 +57,41 @@ # keystone-healthchecks | ||
## Using Existing Health Checks | ||
There are several health checks of kinds often used in a keystone application provided, a List health check to check on a keystone model and ensure database connectivity, and a uri health check that can check a generic external dependency. | ||
These both have a class that extends `HealthCheck` as well as a factory function to create them. | ||
These can be required at: | ||
```js | ||
const { healthchecks } = require('keystone-healthchecks'); | ||
``` | ||
# canQueryListFactory | ||
This function takes in a keystone List object, and returns a health check that will perform a `findOne` operation on the list. You can set one up as follows: | ||
```js | ||
const User = require('keystone').List('User'); | ||
const canQueryListFactory = require('keystone-healthchecks').healthchecks.canQueryListFactory | ||
const check = canQueryListFactory(User); | ||
``` | ||
# canQueryUriFactory | ||
This is a standard health check for an external uri which does not require any form of authorisation. It makes a http request to the endpoint, and treats a 200 response as a valid status, while treating all other responses as an error. It can be set up as follows. | ||
It has one required parameters, a `uri`, and then two optional parameters, `siteName` and `timeout`. | ||
If no `siteName` is provided, the check's name is defaulted to the uri. If no `timeout` is provided, the `timeout` is defaulted to 3 seconds. | ||
```js | ||
const canQueryUriFactory = require('keystone-healthchecks').healthchecks.canQueryUriFactory. | ||
const check = canQueryUriFactory('http://aplaceontheinternet.com' | ||
``` | ||
## License | ||
MIT Licensed. Copyright (c) 2017 Thinkmill Pty Ltd |
@@ -7,3 +7,5 @@ module.exports = { | ||
canQueryListFactory: require('./healthchecks/canQueryListFactory'), | ||
} | ||
CanQueryUri: require('./healthchecks/CanQueryUri'), | ||
canQueryUriFactory: require('./healthchecks/canQueryUriFactory'), | ||
}, | ||
}; |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
28649
16
188
97
5
2