fix: increase rate limit to 1000/15min, add WatchHistory error handling
This commit is contained in:
+10
-10
@@ -1,13 +1,13 @@
|
||||
import express from "express";
|
||||
import cors from "cors";
|
||||
import helmet from "helmet";
|
||||
import morgan from "morgan";
|
||||
import rateLimit from "express-rate-limit";
|
||||
import { createServer } from "http";
|
||||
import { Server } from "socket.io";
|
||||
import dotenv from "dotenv";
|
||||
import express from "express";
|
||||
import rateLimit from "express-rate-limit";
|
||||
import fs from "fs";
|
||||
import helmet from "helmet";
|
||||
import { createServer } from "http";
|
||||
import morgan from "morgan";
|
||||
import path from "path";
|
||||
import { Server } from "socket.io";
|
||||
|
||||
// BigInt JSON support - MUST BE BEFORE ROUTERS
|
||||
(BigInt.prototype as any).toJSON = function () {
|
||||
@@ -61,12 +61,12 @@ app.use(
|
||||
}),
|
||||
);
|
||||
|
||||
// Rate limiting
|
||||
// Rate limiting - generous for small user base
|
||||
const limiter = rateLimit({
|
||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
||||
max: 100, // limit each IP to 100 requests per windowMs
|
||||
windowMs: 15 * 60 * 1000,
|
||||
max: 1000,
|
||||
});
|
||||
app.use(limiter);
|
||||
app.use("/api", limiter);
|
||||
|
||||
// Body parsing
|
||||
app.use(express.json({ limit: "10mb" }));
|
||||
|
||||
Reference in New Issue
Block a user