Skip to content

Commit

Permalink
ratelimit added
Browse files Browse the repository at this point in the history
  • Loading branch information
daneedev committed May 1, 2024
1 parent 8cfda68 commit 10b9ee4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"connect-session-sequelize": "^7.1.7",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"express-rate-limit": "^7.2.0",
"express-session": "^1.18.0",
"js-sha256": "^0.11.0",
"mariadb": "^3.3.0",
Expand Down
6 changes: 6 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const session = require("express-session")
const SequelizeStore = require("connect-session-sequelize")(session.Store);
const bodyParser = require('body-parser');
const flash = require('connect-flash');
const { rateLimit } = require('express-rate-limit');

app.set("view engine", "html")

Expand All @@ -34,6 +35,11 @@ app.use(passport.session());
// FLASH MESSAGES
app.use(flash())

// RATE LIMIT
app.use(rateLimit({
windowMs: 5 * 60 * 1000,
max: 250
}));

app.use("/", express.static(path.join(__dirname, "public")))

Expand Down

0 comments on commit 10b9ee4

Please sign in to comment.