refactor: add body limit middleware

This commit is contained in:
Nicolas Meienberger 2026-01-30 21:36:15 +01:00
parent e70609e116
commit 6f8ff9d606

View file

@ -1,5 +1,6 @@
import { Scalar } from "@scalar/hono-api-reference";
import { Hono } from "hono";
import { bodyLimit } from "hono/body-limit";
import { cors } from "hono/cors";
import { logger as honoLogger } from "hono/logger";
import { secureHeaders } from "hono/secure-headers";
@ -64,6 +65,13 @@ export const createApp = () => {
);
}
app.use(
bodyLimit({
maxSize: 10 * 1024 * 1024, // 10MB
onError: (c) => c.json({ message: "Request body too large" }, 413),
}),
);
app
.get("healthcheck", (c) => c.json({ status: "ok" }))
.route("/api/v1/auth", authController)