1.1.0 • Published 8 years ago
express-brute-nedb v1.1.0
express-brute-nedb
An express-brute store using nedb
Installation
npm install express-brute-nedbUsage
const ExpressBrute = require('express-brute'),
ExpressBruteNedbStore = require('express-brute-nedb');
const store = new ExpressBruteNedbStore({
filename: './brute.db' // See all available options below
});
const bruteforce = new ExpressBrute(store);
app.post('/auth',
bruteforce.prevent, // error 429 if we hit this route too often
(req, res, next) => {
res.send('Success!');
}
);Options
Available parameters:
filenamePath to the database file. If left empty, in-memory database is used. Defaults to nothing (which is NOT recommended).prefixA prefix to the keys used in express-brute. However, multiple instances of express-brute have their own unique keys so it is not needed to provide a prefix at all.debugSet a debug function, that receives an error when something goes wrong. Defaults tonoop.compactIntervalSets an interval to auto-compact the NeDB database file. This is required since the write-only policy of NeDB, used with large write count of Express Brute can produce a very large file. The default interval is 2 minutes (120000 miliseconds).
License
MIT