refactor: add body limit middleware
This commit is contained in:
parent
e70609e116
commit
6f8ff9d606
1 changed files with 8 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue