https://github.com/requarks/express-brute-loki
A Loki.js store for Express-Brute
https://github.com/requarks/express-brute-loki
Last synced: about 1 year ago
JSON representation
A Loki.js store for Express-Brute
- Host: GitHub
- URL: https://github.com/requarks/express-brute-loki
- Owner: requarks
- License: mit
- Created: 2016-08-21T18:09:47.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-02-24T15:44:19.000Z (over 4 years ago)
- Last Synced: 2025-05-09T03:03:59.327Z (about 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 13
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# express-brute-loki
[](https://www.npmjs.com/package/express-brute-loki)
[](https://travis-ci.org/Requarks/express-brute-loki)
[](https://www.codacy.com/app/Requarks/express-brute-loki)
[](https://gemnasium.com/github.com/Requarks/express-brute-loki)
[](https://snyk.io/test/github/requarks/express-brute-loki)
[](https://github.com/requarks/express-brute-loki/blob/master/LICENSE)
##### A Loki.js store for Express-Brute
### Installation
```shell
npm install express-brute-loki
```
### Usage
```js
var ExpressBrute = require('express-brute'),
ExpressBruteLokiStore = require('express-brute-loki');
var store = new ExpressBruteLokiStore({
path: './brute.db' // See all available options below
});
var bruteforce = new ExpressBrute(store);
app.post('/auth',
bruteforce.prevent, // error 403 if we hit this route too often
function (req, res, next) {
res.send('Success!');
}
);
```
### Options
Setting the `path` to the database file is optional but recommended.
Available parameters:
- `path` Path to the database file. Defaults to `./brute-store.db`
- `autosave` Set `false` to disable save to disk. Defaults to `true`
- `ttl` Duration in seconds to keep entries. Set to `0` to disable TTL. Defaults to `0`
- `logErrors` Whether or not to log client errors. Defaults to `false`
- If `true`, a default logging function (`console.error`) is provided.
- If a function, it is called anytime an error occurs (useful for custom logging)
- If `false`, no logging occurs.
### License
MIT