+11
-3
@@ -1,4 +1,5 @@
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { ValidationPipe, Logger } from '@nestjs/common';
|
||||
import cookieParser from 'cookie-parser';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
@@ -9,6 +10,10 @@ async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
const config = app.get(ConfigService);
|
||||
const logger = new Logger('Bootstrap');
|
||||
|
||||
// enable cookie parser so req.cookies is populated
|
||||
app.use(cookieParser());
|
||||
|
||||
app.setGlobalPrefix('');
|
||||
|
||||
@@ -55,11 +60,14 @@ async function bootstrap() {
|
||||
SwaggerModule.setup('ApiList', app, document);
|
||||
}
|
||||
|
||||
const port = config.get<number>('PORT') || 3000;
|
||||
const port = config.get<number>('PORT') || 3000;
|
||||
|
||||
logger.log(`Allowed CORS origins: ${JSON.stringify(allowedOrigins)}`);
|
||||
logger.log(`Server listening on port ${port}`);
|
||||
|
||||
await app.listen(port);
|
||||
|
||||
console.log(`Server running on http://localhost:${port}`);
|
||||
logger.log(`Server running on http://localhost:${port}`);
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
Reference in New Issue
Block a user