From 4489f10f637ed1bad5ed95917b236906edf0f210 Mon Sep 17 00:00:00 2001 From: LaoShui <79132480+laoshuikaixue@users.noreply.github.com> Date: Wed, 18 Feb 2026 16:08:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(server):=20=E5=A2=9E=E5=8A=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8A=E4=BC=A0=E5=A4=A7=E5=B0=8F=E9=99=90=E5=88=B6?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将请求体大小限制从 50MB 增加到 500MB - 配置文件上传中间件支持 500MB 大小限制 - 设置临时文件目录为 /tmp/ - 启用 useTempFiles 选项以提高性能 - 配置达到限制时自动中止上传 --- server.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index a9f53db..3736761 100644 --- a/server.js +++ b/server.js @@ -178,10 +178,17 @@ async function consturctServer(moduleDefs) { /** * Body Parser and File Upload */ - app.use(express.json({ limit: '50mb' })) - app.use(express.urlencoded({ extended: false, limit: '50mb' })) + app.use(express.json({ limit: '500mb' })) + app.use(express.urlencoded({ extended: false, limit: '500mb' })) - app.use(fileUpload()) + app.use(fileUpload({ + limits: { + fileSize: 500 * 1024 * 1024 // 500MB + }, + useTempFiles: false, + tempFileDir: '/tmp/', + abortOnLimit: true + })) /** * Cache