New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

keystone-healthchecks

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keystone-healthchecks

Healthchecks Framework for KeystoneJS (or any Express app)

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

keystone-healthchecks

Healthchecks Framework for KeystoneJS (or any Express app)

Enable the default healthchecks for Keystone by adding this package to your project and setting the following option:

keystone.set('healthchecks', true)

Or, you can define your own healthchecks and import them like this:

// this will import all javascript files in the ./healthchecks directory
keystone.set('healthchecks', keystone.import('healthchecks'));

Custom Integration

For more control, you can create the healthcheck route handler and plug it into any express app or router by using the createRoute method, e.g

const checks = { MyHealthCheck }; // see below
app.use('/is-everything-ok', require('keystone-healthchecks').createRoute(checks));

Creating Healthchecks

Each healthcheck should export a Class that extends Healthcheck, e.g

const healthchecks = require('keystone-healthchecks');
const Healthcheck = healthchecks.Healthcheck;

module.exports = class MyHealthCheck extends Healthcheck {
	// optional, will default to the name of the Class
	get name () {
		return `My Health Check`;
	}
	// optional, defines a timeout for the check in ms
	get timeout () {
		return 500;
	}
	// required, must return a Promise or Promise.resolve for pass or
	// Promise.reject for fail. The argument passed to the resolve / reject
	// will be returned by the healthcheck endpoint, along with the status
	resolver () {
		return keepCalmAndCarryOn()
			.then(() => Promise.resolve('This is Fine'))
			.catch(() => Promise.reject('OMG THIS IS NOT OK'));
	}
};

License

MIT Licensed. Copyright (c) 2017 Thinkmill Pty Ltd

Keywords

FAQs

Package last updated on 17 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc