251206:1710 specs: frontend plan P1,P3 wait Verification
Some checks failed
Spec Validation / validate-markdown (push) Has been cancelled
Spec Validation / validate-diagrams (push) Has been cancelled
Spec Validation / check-todos (push) Has been cancelled

This commit is contained in:
admin
2025-12-06 17:10:56 +07:00
parent be3b71007a
commit 5c49bac772
40 changed files with 977 additions and 244 deletions

View File

@@ -22,11 +22,24 @@ async function bootstrap() {
const logger = new Logger('Bootstrap');
// 🛡️ 2. Security (Helmet & CORS)
app.use(helmet());
// ปรับ CSP ให้รองรับ Swagger UI
app.use(
helmet({
contentSecurityPolicy: {
directives: {
defaultSrc: ["'self'"],
scriptSrc: ["'self'", "'unsafe-inline'", "'unsafe-eval'"],
styleSrc: ["'self'", "'unsafe-inline'"],
imgSrc: ["'self'", 'data:', 'blob:'],
},
},
crossOriginEmbedderPolicy: false,
})
);
// ตั้งค่า CORS (ใน Production ควรระบุ origin ให้ชัดเจนจาก Config)
app.enableCors({
origin: true, // หรือ configService.get('CORS_ORIGIN')
origin: configService.get<string>('CORS_ORIGIN') || true,
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
credentials: true,
});
@@ -47,7 +60,7 @@ async function bootstrap() {
transformOptions: {
enableImplicitConversion: true, // ช่วยแปลง Type ใน Query Params
},
}),
})
);
// ลงทะเบียน Global Interceptor และ Filter ที่เราสร้างไว้
@@ -78,4 +91,4 @@ async function bootstrap() {
logger.log(`Application is running on: ${await app.getUrl()}/api`);
logger.log(`Swagger UI is available at: ${await app.getUrl()}/docs`);
}
bootstrap();
void bootstrap();