From 6f8ff9d606c22acdf132b772b748d092024b10cb Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Fri, 30 Jan 2026 21:36:15 +0100 Subject: [PATCH] refactor: add body limit middleware --- app/server/app.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/server/app.ts b/app/server/app.ts index 5df7f999..3cdfa803 100644 --- a/app/server/app.ts +++ b/app/server/app.ts @@ -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)