UNPKG

fensr

Version:

Fensr – Throttle wisely. Protect efficiently. A fast, Redis-powered rate limiting middleware for Node.js and Express.

17 lines (12 loc) 424 B
import express from "express"; import { createRateLimiter } from "../src/limiter"; const app = express(); const PORT = process.env.PORT || 3000; // Apply rate limiting middleware globally app.use(createRateLimiter()); app.get("/", (req, res) => { res.send("You're within the rate limit. Welcome to Fensr!"); }); app.listen(PORT, () => { console.log(`Server running at http://localhost:${PORT}`); });