|
|
@@ -1,8 +1,38 @@
|
|
|
import { NestFactory } from '@nestjs/core';
|
|
|
import { AppModule } from './app.module';
|
|
|
+import { ValidationPipe } from '@nestjs/common';
|
|
|
+import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
|
+
|
|
|
+//{{ https://stackoverflow.com/questions/52783959/nest-js-request-entity-too-large-payloadtoolargeerror-request-entity-too-larg
|
|
|
+import * as bodyParser from 'body-parser';
|
|
|
+//}} https://stackoverflow.com/questions/52783959/nest-js-request-entity-too-large-payloadtoolargeerror-request-entity-too-larg
|
|
|
|
|
|
async function bootstrap() {
|
|
|
const app = await NestFactory.create(AppModule);
|
|
|
+
|
|
|
+ app.useGlobalPipes(new ValidationPipe());
|
|
|
+
|
|
|
+ app.setGlobalPrefix('api/v2');
|
|
|
+
|
|
|
+ //{{ https://stackoverflow.com/questions/52783959/nest-js-request-entity-too-large-payloadtoolargeerror-request-entity-too-larg
|
|
|
+ // Установка лимита размера тела запроса 50 Мб (По умолчанию 1 Мб)
|
|
|
+ app.use(bodyParser.json({ limit: '50mb' }));
|
|
|
+ app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
|
|
|
+ //}} https://stackoverflow.com/questions/52783959/nest-js-request-entity-too-large-payloadtoolargeerror-request-entity-too-larg
|
|
|
+
|
|
|
+ const swaggerConfig = new DocumentBuilder()
|
|
|
+ .setTitle('Price Management')
|
|
|
+ .setDescription(
|
|
|
+ 'Микросервис расчета итоговых цен с учетом скидок и их хранения',
|
|
|
+ )
|
|
|
+ .setVersion('0.2.0')
|
|
|
+ .addTag('PriceManagement')
|
|
|
+ .build();
|
|
|
+
|
|
|
+ const document = SwaggerModule.createDocument(app, swaggerConfig);
|
|
|
+ SwaggerModule.setup('api', app, document);
|
|
|
+
|
|
|
await app.listen(3000);
|
|
|
}
|
|
|
+
|
|
|
bootstrap();
|