import './config' ; import { NestFactory } from '@nestjs/core' ; import * as Sentry from '@sentry/node' ; import { RedisIoAdapter } from './shared/framework/redis.adapter' ; import { version } from '../package.json' ; import { AppModule } from './app.module' ; if ( process . env . SENTRY_DSN ) { Sentry . init ( { dsn : process . env . SENTRY_DSN , environment : process . env . NODE_ENV , release : `v${ version }` , } ) ; } export async function bootstrap ( ) { const app = await NestFactory . create ( AppModule ) ; app . enableCors ( { origin : process . env . NODE_ENV === 'dev' || process . env . NODE_ENV === 'test' ? '*' : [ process . env . FRONT_BASE_URL , process . env . WIDGET_BASE_URL ] , preflightContinue : false , allowedHeaders : [ 'Content-Type' , 'Authorization' ] , methods : [ 'GET' , 'HEAD' , 'POST' , 'PUT' , 'DELETE' , 'OPTIONS' ] , } ) ; app . useWebSocketAdapter ( new RedisIoAdapter ( app ) ) ; await app . listen ( process . env . PORT ) ; }