A lowdb storage adapter for express-brute middleware
via npm:
$ npm install express-brute-lowdb
via yarn:
$ yarn add express-brute-lowdb
const ExpressBrute = require('express-brute')
const LowdbStore = require('express-brute-lowdb');
const store = new LowdbStore();
const bruteforce = new ExpressBrute(store);
app.post('/auth',
bruteforce.prevent,
(req, res, next) => {
res.send('Success!')
}
);
Available options:
Name | Type | Description | Required |
---|---|---|---|
prefix |
String |
Prefix for each lowdb key | false |
adapter |
Function |
lowdb adapter Constructor | false |
adapterArgs |
Array |
Arguments for adapter Constructor | false |
rootKey |
String |
name for database objects's root key | false |
Example:
const Memory = require('lowdb/adapters/Memory') // or
const FileSync = require('lowdb/adapters/FileSync')
// defaults:
const options = {
prefix: '',
adapter: Memory, // only `Memory` & `FileSync` adapters are currently supported
adapterArgs: ['express-brute.json'],
rootKey: 'express-brute'
}
const store = new LowdbStore(options);
N.B.: lowdb's Memory
adapter is not suitable for production usage
Changelog for express-brute-lowdb
Licensed under the MIT License. Check the LICENSE file for details.