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
var hellban = require('express-hellban');
var isBanned = function() {
if(!req.user) {
return true;
else {
return req.user.isBanned;
}
}
app.post('*', hellban(isBanned, {
log: false,
failureRate: 1.0,
minWaitTime: 5000,
maxWaitTime: 10000,
onSuccess: function(req, res, next) { next(); },
onFailure: function(req, res, next) { res.send(500); }
}));