const express = require('express');
const Limiter = require('express-ddos-protector');
const limit = new Limiter();
const app = express();
const port = 3000;
// Apply to all requests
app.get('/', limit.limitRequests(1, 2, 1000), (req, res) => {
const Blacklist = limit.Blacklist;
if (Blacklist.includes(req.ip)) {
res.send('access denied');
} else {
res.send('hello world');
}
});
app.listen(port, () => console.log(`Example app listening on port ${port}!`));
-
Notifications
You must be signed in to change notification settings - Fork 0
lawrence14701-zz/express-ddos-protector
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published