feat(server): 增加文件上传大小限制并优化配置

- 将请求体大小限制从 50MB 增加到 500MB
- 配置文件上传中间件支持 500MB 大小限制
- 设置临时文件目录为 /tmp/
- 启用 useTempFiles 选项以提高性能
- 配置达到限制时自动中止上传
This commit is contained in:
LaoShui 2026-02-18 16:08:40 +08:00
parent 2047bdfa65
commit 4489f10f63

View File

@ -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