Express middleware that checks if the last consecutiveFailures
runs of a route failed, it helps keep track of the health of a service without generating extra load.
A route failure is defined as response status code being above failThreshold
.
If there are consecutiveFailures
consecutive failures, the health is considered bad.
Example:
var express = ;var app = ; var health = ; health; app; app; app;
In the above example, the /health endpoint will return 500 if the last 10 runs returned a status code >= 500 and 204 otherwise.