express-hellban
v0.1.1express-hellban
Express.js middleware for hellbanning lusers.
// 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(); },
onFailure: function(req, res, next) { res.send(500); }
}));
npm i express-hellban
Source Code
github.com/jwietelmann/expre...Metadata
- Unknown
- Whatever
- Joel Wietelmann
- released 12/7/2012