|
@@ -3,12 +3,18 @@ import { AppModule } from './app.module';
|
|
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
|
import { ErrorsInterceptor } from './interceptor/errors.interceptor';
|
|
|
+import mainConfig from 'config.json';
|
|
|
|
|
|
async function bootstrap() {
|
|
|
const app = await NestFactory.create(AppModule);
|
|
|
app.useGlobalPipes(new ValidationPipe());
|
|
|
app.useGlobalInterceptors(new ErrorsInterceptor());
|
|
|
app.setGlobalPrefix('api');
|
|
|
+ app.enableCors({
|
|
|
+ origin: mainConfig.cors,
|
|
|
+ credentials: true,
|
|
|
+ exposedHeaders: ['set-cookie'],
|
|
|
+ });
|
|
|
|
|
|
// SWAGGER
|
|
|
const config = new DocumentBuilder()
|
|
@@ -19,6 +25,6 @@ async function bootstrap() {
|
|
|
const document = SwaggerModule.createDocument(app, config);
|
|
|
SwaggerModule.setup('api', app, document);
|
|
|
|
|
|
- await app.listen(3000);
|
|
|
+ await app.listen(mainConfig.port);
|
|
|
}
|
|
|
bootstrap();
|