first commit
This commit is contained in:
34
apps/api-gateway/src/main.ts
Normal file
34
apps/api-gateway/src/main.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
import { AppModule } from './app.module';
|
||||
import { AllExceptionsFilter } from './grpc-exception.filter';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
app.enableCors({ origin: true, credentials: true });
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: true,
|
||||
transform: true,
|
||||
forbidNonWhitelisted: true
|
||||
})
|
||||
);
|
||||
app.useGlobalFilters(new AllExceptionsFilter());
|
||||
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle('Lendry ID API')
|
||||
.setDescription('REST API для единого входа, безопасности, RBAC и администрирования Lendry ID.')
|
||||
.setVersion('0.1.0')
|
||||
.addBearerAuth()
|
||||
.build();
|
||||
const document = SwaggerModule.createDocument(app, config);
|
||||
SwaggerModule.setup('docs', app, document, {
|
||||
swaggerOptions: { persistAuthorization: true },
|
||||
customSiteTitle: 'Документация Lendry ID API'
|
||||
});
|
||||
|
||||
await app.listen(process.env.PORT ? Number(process.env.PORT) : 3000);
|
||||
}
|
||||
|
||||
void bootstrap();
|
||||
Reference in New Issue
Block a user