chore: import DH V2 D5.6.4 production baseline
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import 'reflect-metadata';
|
||||
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { NestExpressApplication } from '@nestjs/platform-express';
|
||||
import cookieParser = require('cookie-parser');
|
||||
import helmet from 'helmet';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
import { ApiExceptionFilter } from './common/filters/api-exception.filter';
|
||||
import { requestIdMiddleware } from './common/http/request-id.middleware';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create<NestExpressApplication>(
|
||||
AppModule,
|
||||
{
|
||||
bufferLogs: true,
|
||||
},
|
||||
);
|
||||
|
||||
app.set('trust proxy', 1);
|
||||
|
||||
app.getHttpAdapter().getInstance().disable('x-powered-by');
|
||||
|
||||
app.use(
|
||||
helmet({
|
||||
contentSecurityPolicy: false,
|
||||
crossOriginResourcePolicy: {
|
||||
policy: 'same-site',
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
app.use(requestIdMiddleware);
|
||||
app.use(cookieParser());
|
||||
|
||||
app.useBodyParser('json', {
|
||||
limit: '1mb',
|
||||
});
|
||||
|
||||
app.useBodyParser('urlencoded', {
|
||||
limit: '1mb',
|
||||
extended: false,
|
||||
});
|
||||
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
transform: true,
|
||||
}),
|
||||
);
|
||||
|
||||
app.useGlobalFilters(new ApiExceptionFilter());
|
||||
|
||||
app.setGlobalPrefix('api/v3');
|
||||
|
||||
app.enableShutdownHooks();
|
||||
|
||||
const port = Number(process.env.API_PORT ?? 3000);
|
||||
|
||||
await app.listen(port, '0.0.0.0');
|
||||
}
|
||||
|
||||
bootstrap().catch((error: unknown) => {
|
||||
console.error('Fatal bootstrap error');
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user