43 lines
1.6 KiB
JavaScript
43 lines
1.6 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const common_1 = require("@nestjs/common");
|
|
const core_1 = require("@nestjs/core");
|
|
const app_module_1 = require("./app.module");
|
|
const global_exception_filter_1 = require("./common/filters/global-exception.filter");
|
|
const helmet_1 = require("helmet");
|
|
async function bootstrap() {
|
|
const app = await core_1.NestFactory.create(app_module_1.AppModule);
|
|
const allowedOrigin = process.env.ALLOWED_ORIGIN || 'https://recept.gynther.se';
|
|
app.enableCors({
|
|
origin: allowedOrigin,
|
|
methods: ['GET', 'POST', 'PATCH', 'PUT', 'DELETE', 'OPTIONS'],
|
|
allowedHeaders: ['Content-Type', 'Authorization'],
|
|
credentials: true,
|
|
});
|
|
app.use((0, helmet_1.default)({
|
|
contentSecurityPolicy: false,
|
|
crossOriginEmbedderPolicy: true,
|
|
crossOriginOpenerPolicy: { policy: 'same-origin' },
|
|
crossOriginResourcePolicy: { policy: 'same-origin' },
|
|
originAgentCluster: true,
|
|
referrerPolicy: { policy: 'strict-origin-when-cross-origin' },
|
|
strictTransportSecurity: {
|
|
maxAge: 31536000,
|
|
includeSubDomains: true,
|
|
preload: true,
|
|
},
|
|
xContentTypeOptions: true,
|
|
xFrameOptions: { action: 'deny' },
|
|
xXssProtection: false,
|
|
}));
|
|
app.setGlobalPrefix('api');
|
|
app.useGlobalFilters(new global_exception_filter_1.GlobalExceptionFilter());
|
|
app.useGlobalPipes(new common_1.ValidationPipe({
|
|
whitelist: true,
|
|
forbidNonWhitelisted: true,
|
|
transform: true,
|
|
}));
|
|
await app.listen(8080, '0.0.0.0');
|
|
}
|
|
bootstrap();
|
|
//# sourceMappingURL=main.js.map
|