express-brute-lowdb
v0.1.0
Published
A lowdb storage adapter for express-brute middleware
Downloads
7
Readme
express-brute-lowdb
A lowdb storage adapter for express-brute middleware
Installation
via npm:
$ npm install express-brute-lowdb
via yarn:
$ yarn add express-brute-lowdb
Usage
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!')
}
);
Options
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
Useful Links
Changelog
Changelog for express-brute-lowdb
License
Licensed under the MIT License. Check the LICENSE file for details.