حل مشكلة request entity too large لحفظ الصور التي تزيد عن 20 كيلوبايت
الحل:
import { NestFactory } from '@nestjs/core';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { AppModule } from './app.module';
import { json, urlencoded } from 'express';
async function bootstrap() {
const app = await NestFactory.create(AppModule, { cors: true });
const config = new DocumentBuilder()
.setTitle('Alyahya API')
.setDescription('The cats API description')
.setVersion('1.0')
.addTag('cats')
.build()
;
// app.setGlobalPrefix('api');
app.use(json({ limit: '50mb' }));
app.use(urlencoded({ extended: true, limit: '50mb' }));
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('api', app, document);
app.useGlobalInterceptors(); //UseHttpsRedirection()
await app.listen(process.env.PORT || 3000);
}
bootstrap();
تعليقات
إرسال تعليق