Skip to content
This repository was archived by the owner on Jun 29, 2025. It is now read-only.

Commit 24e100b

Browse files
committed
fix: changing the chunk size needed an app restart
1 parent 1da4fee commit 24e100b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

backend/src/main.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { NestExpressApplication } from "@nestjs/platform-express";
88
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
99
import * as bodyParser from "body-parser";
1010
import * as cookieParser from "cookie-parser";
11+
import { NextFunction, Request, Response } from "express";
1112
import * as fs from "fs";
1213
import { AppModule } from "./app.module";
1314
import { ConfigService } from "./config/config.service";
@@ -20,12 +21,13 @@ async function bootstrap() {
2021

2122
const config = app.get<ConfigService>(ConfigService);
2223

23-
app.use(
24+
app.use((req: Request, res: Response, next: NextFunction) => {
25+
const chunkSize = config.get("share.chunkSize");
2426
bodyParser.raw({
2527
type: "application/octet-stream",
26-
limit: `${config.get("share.chunkSize")}B`,
27-
}),
28-
);
28+
limit: `${chunkSize}B`,
29+
})(req, res, next);
30+
});
2931

3032
app.use(cookieParser());
3133
app.set("trust proxy", true);

0 commit comments

Comments
 (0)