Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app = await NestFactory.create(appModule.AppModule, {
cors: config.cors,
logger: new Logger(),
});
app.setGlobalPrefix('api');
// DefaultLogger.restoreOriginalLogLevel();
// app.useLogger(new Logger());
app.use(helmet());
app.use(compression());
app.use(bodyParser.json({ limit: '1mb' }));
app.use(bodyParser.urlencoded({ extended: true }));
// app.use(rateLimit({ max: 1000, windowMs: 15 * 60 * 1000 }));
app.useGlobalFilters(new HttpExceptionFilter());
app.useGlobalPipes(new ValidationPipe());
app.useGlobalInterceptors(
new TransformInterceptor(new Reflector()),
new ErrorInterceptor(new Reflector()),
new LoggingInterceptor(),
);
// const options = new DocumentBuilder()
// .setTitle('播客系统服务端 API')
// .setDescription('The Podcast API')
// .setVersion('2.0')
// .addTag('Podcast Server')
// .build();
// const document = SwaggerModule.createDocument(app, options);
// SwaggerModule.setup('apidoc', app, document);
// return await app.listen(appConfig.APP.PORT);
await app.listen(config.port, config.hostname);
logWelcomeMessage(config);
return app;
async function bootstrap() {
const app = await NestFactory.create(AppModule, isProdMode ? { logger: false } : null);
// app.use()
app.use(helmet());
app.use(compression());
app.use(bodyParser.json({ limit: '1mb' }));
app.useGlobalFilters(new HttpExceptionFilter());
app.useGlobalPipes(new ValidationPipe());
app.useGlobalInterceptors(
new TransformInterceptor(new Reflector()),
new ErrorInterceptor(new Reflector()),
new LoggingInterceptor(),
);
const options = new DocumentBuilder()
.setTitle('播客系统服务端')
.setDescription('The Podcast API')
.setVersion('2.0')
.addTag('Podcast Server')
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('api', app, document);
return await app.listen(appConfig.APP.PORT);
}
async function bootstrap() {
const app = await NestFactory.create(AppModule, isProdMode ? { logger: false } : null);
// app.use()
app.use(helmet());
app.use(compression());
app.use(bodyParser.json({ limit: '1mb' }));
app.useGlobalFilters(new HttpExceptionFilter());
app.useGlobalPipes(new ValidationPipe());
app.useGlobalInterceptors(
new TransformInterceptor(new Reflector()),
new ErrorInterceptor(new Reflector()),
new LoggingInterceptor(),
);
const options = new DocumentBuilder()
.setTitle('播客系统服务端')
.setDescription('The Podcast API')
.setVersion('2.0')
.addTag('Podcast Server')
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('api', app, document);
return await app.listen(appConfig.APP.PORT);
}
async function bootstrap() {
const app = await NestFactory.create(
AppModule,
isProdMode ? { logger: false } : null,
);
app.use(helmet());
app.use(compression());
app.use(bodyParser.json({ limit: '1mb' }));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(rateLimit({ max: 1000, windowMs: 15 * 60 * 1000 }));
app.useGlobalFilters(new HttpExceptionFilter());
app.useGlobalPipes(new ValidationPipe());
app.useGlobalInterceptors(
new TransformInterceptor(new Reflector()),
new ErrorInterceptor(new Reflector()),
new LoggingInterceptor(),
);
return await app.listen(APP_CONFIG.APP.PORT);
}
async function bootstrap() {
const app = await NestFactory.create(
AppModule,
isProdMode ? { logger: false } : null,
);
app.use(helmet());
app.use(compression());
app.use(bodyParser.json({ limit: '1mb' }));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(rateLimit({ max: 1000, windowMs: 15 * 60 * 1000 }));
app.useGlobalFilters(new HttpExceptionFilter());
app.useGlobalPipes(new ValidationPipe());
app.useGlobalInterceptors(
new TransformInterceptor(new Reflector()),
new ErrorInterceptor(new Reflector()),
new LoggingInterceptor(),
);
return await app.listen(APP_CONFIG.APP.PORT);
}