refactor: rename prestataire to constructeur
This commit is contained in:
14
dist/main.js
vendored
14
dist/main.js
vendored
@@ -5,8 +5,18 @@ const common_1 = require("@nestjs/common");
|
||||
const app_module_1 = require("./app.module");
|
||||
async function bootstrap() {
|
||||
const app = await core_1.NestFactory.create(app_module_1.AppModule);
|
||||
const allowedOrigins = process.env.CORS_ORIGIN
|
||||
? process.env.CORS_ORIGIN.split(',').map(origin => origin.trim())
|
||||
: ['http://localhost:3001'];
|
||||
app.enableCors({
|
||||
origin: process.env.CORS_ORIGIN || 'http://localhost:3001',
|
||||
origin: (origin, callback) => {
|
||||
if (!origin || allowedOrigins.includes(origin)) {
|
||||
callback(null, true);
|
||||
}
|
||||
else {
|
||||
callback(new Error(`Origin ${origin} not allowed by CORS`));
|
||||
}
|
||||
},
|
||||
credentials: true,
|
||||
});
|
||||
app.useGlobalPipes(new common_1.ValidationPipe({
|
||||
@@ -16,7 +26,7 @@ async function bootstrap() {
|
||||
}));
|
||||
const apiPrefix = process.env.API_PREFIX || 'api';
|
||||
app.setGlobalPrefix(apiPrefix);
|
||||
const port = process.env.PORT || 3000;
|
||||
const port = Number(process.env.PORT) || 3000;
|
||||
await app.listen(port);
|
||||
console.log(`Application is running on: http://localhost:${port}`);
|
||||
console.log(`Environment: ${process.env.NODE_ENV || 'development'}`);
|
||||
|
||||
Reference in New Issue
Block a user