JavaScript: Add support for rateLimit export from express-rate-limit package.

This commit is contained in:
Max Schaefer
2023-10-26 12:12:16 +01:00
parent 28bedda5ea
commit bb146a1758
4 changed files with 32 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
import express from "express";
import { rateLimit } from "express-rate-limit";
const app = express();
const limiter = rateLimit();
app.use(limiter)
function expensiveHandler(req, res) { login(); }
app.get('/:path', expensiveHandler); // OK

View File

@@ -0,0 +1,10 @@
import express from "express";
import rateLimit from "express-rate-limit";
const app = express();
const limiter = rateLimit();
app.use(limiter)
function expensiveHandler(req, res) { login(); }
app.get('/:path', expensiveHandler); // OK