feat: increase upload size limit (#962)
This commit is contained in:
@ -1,10 +1,14 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
|
||||
import * as bodyParser from 'body-parser';
|
||||
import { graphqlUploadExpress } from 'graphql-upload';
|
||||
import bytes from 'bytes';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
import { settings } from './constants/settings';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
cors: true,
|
||||
@ -13,8 +17,21 @@ async function bootstrap() {
|
||||
// Apply validation pipes globally
|
||||
app.useGlobalPipes(new ValidationPipe());
|
||||
|
||||
app.use(bodyParser.json({ limit: settings.storage.maxFileSize }));
|
||||
app.use(
|
||||
bodyParser.urlencoded({
|
||||
limit: settings.storage.maxFileSize,
|
||||
extended: true,
|
||||
}),
|
||||
);
|
||||
|
||||
// Graphql file upload
|
||||
app.use(graphqlUploadExpress());
|
||||
app.use(
|
||||
graphqlUploadExpress({
|
||||
maxFieldSize: bytes(settings.storage.maxFileSize),
|
||||
maxFiles: 10,
|
||||
}),
|
||||
);
|
||||
|
||||
await app.listen(3000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user