chore(backend): remove global api prefix
This commit is contained in:
21
src/main.ts
21
src/main.ts
@@ -25,7 +25,8 @@ async function bootstrap() {
|
||||
saveUninitialized: false,
|
||||
cookie: {
|
||||
httpOnly: true,
|
||||
sameSite: (process.env.SESSION_SAME_SITE as 'strict' | 'lax' | 'none') ?? 'lax',
|
||||
sameSite:
|
||||
(process.env.SESSION_SAME_SITE as 'strict' | 'lax' | 'none') ?? 'lax',
|
||||
secure: sessionCookieSecure,
|
||||
maxAge: Number(process.env.SESSION_MAX_AGE ?? 1000 * 60 * 60 * 24 * 7),
|
||||
},
|
||||
@@ -34,7 +35,7 @@ async function bootstrap() {
|
||||
|
||||
// Récupérer les origines CORS depuis la variable d'environnement (séparées par des virgules)
|
||||
const allowedOrigins = process.env.CORS_ORIGIN
|
||||
? process.env.CORS_ORIGIN.split(',').map(origin => origin.trim())
|
||||
? process.env.CORS_ORIGIN.split(',').map((origin) => origin.trim())
|
||||
: ['http://localhost:3001'];
|
||||
|
||||
app.enableCors({
|
||||
@@ -49,14 +50,14 @@ async function bootstrap() {
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
app.useGlobalPipes(new ValidationPipe({
|
||||
whitelist: process.env.VALIDATION_WHITELIST === 'true',
|
||||
forbidNonWhitelisted: process.env.VALIDATION_FORBID_NON_WHITELISTED === 'true',
|
||||
transform: process.env.VALIDATION_TRANSFORM === 'true',
|
||||
}));
|
||||
|
||||
const apiPrefix = process.env.API_PREFIX || 'api';
|
||||
app.setGlobalPrefix(apiPrefix);
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: process.env.VALIDATION_WHITELIST === 'true',
|
||||
forbidNonWhitelisted:
|
||||
process.env.VALIDATION_FORBID_NON_WHITELISTED === 'true',
|
||||
transform: process.env.VALIDATION_TRANSFORM === 'true',
|
||||
}),
|
||||
);
|
||||
|
||||
const port = Number(process.env.PORT) || 3000;
|
||||
await app.listen(port);
|
||||
|
||||
Reference in New Issue
Block a user