fix: increase rate limit to 1000/15min, add WatchHistory error handling

This commit is contained in:
2026-04-23 12:56:47 -04:00
parent cd15250522
commit 9f76a3c9dd
2 changed files with 34 additions and 12 deletions
+10 -10
View File
@@ -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" }));