# express-hellban

> Express.js middleware for hellbanning lusers.

Latest version **0.1.1** (published 2012-12-07) · 0 weekly downloads

## Install

```sh
npm install express-hellban
pnpm add express-hellban
yarn add express-hellban
bun add express-hellban
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2012-12-07 |
| First published | 2012-12-07 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Joel Wietelmann |
| Maintainers | jwietelmann |

## Links

- npm: https://www.npmjs.com/package/express-hellban
- Repository: https://github.com/jwietelmann/express-hellban
- npm.io page: https://npm.io/package/express-hellban

## Recent versions

- 0.1.1 (latest) — 2012-12-07
- 0.1.0 — 2012-12-07

## README

express-hellban
===============

Express.js middleware for hellbanning lusers.

For banned users, this middleware waits a random number of milliseconds before either responding successfully or throwing a 500 error. Wait time range, failure rate, and success/failure behavior is configurable

```javascript

// get the module loaded
var hellban = require('express-hellban');

// create a function to test whether or not a user is banned
var isBanned = function() {
  if(!req.user) {
    return true;
  else {
    return req.user.isBanned; // passport/everyauth middleware generally set req.user
  }
}

// Put this before the rest of your routes 
// The option values you see below are the defaults
app.post('*', hellban(isBanned, {
  log: false,
  failureRate: 1.0,
  minWaitTime: 5000,
  maxWaitTime: 10000,
  onSuccess: function(req, res, next) { next(); }, // just go to the next matching route
  onFailure: function(req, res, next) { res.send(500); } // HTTP 500 error
}));
```

---
_Source: https://npm.io/package/express-hellban · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
