chore(backend): remove global api prefix

This commit is contained in:
Matthieu
2025-09-19 14:39:48 +02:00
parent 861665f92a
commit 9fdb888d24

View File

@@ -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);