express-cowboy
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Express Cowboy

It calms the thundering herd

Build Status

NPM

Why?

When you have a service that is failing, you don't want to keep hitting it. You want to give it a break and try again later. This is what circuit breakers are for.

For some reason NPM didn't have anything good for Express. Now it does.

This code is heavily based on Opossum's Circuit Breaker implementation.

How?

import * as express from "express";
import { circuitBreakerMiddleware } from "express-cowboy";

const app = express();
const cb = circuitBreakerMiddleware({
  maxFailures: 5,
  timeout: 10000,
  resetTimeout: 30000,
});
app.use(cb.middleware);

Readme

Keywords

none

Package Sidebar

Install

npm i express-cowboy

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

87.7 kB

Total Files

21

Last publish

Collaborators

  • vivalapanda_