Fix API routing for App Platform deployment

- Changed global prefix to use 'v1' in production instead of 'api/v1'
- App Platform ingress routes /api to backend, so backend only needs /v1 prefix
- Maintains backward compatibility: dev uses /api/v1, prod uses /v1

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 22:13:06 +01:00
parent f36999cf43
commit a791b509d8

View File

@@ -9,7 +9,11 @@ async function bootstrap() {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule);
// Global prefix for all routes // Global prefix for all routes
app.setGlobalPrefix('api/v1'); // In production (App Platform), the ingress routes /api to this service
// So we only need /v1 prefix here
// In development, we need the full /api/v1 prefix
const isProduction = process.env.NODE_ENV === 'production';
app.setGlobalPrefix(isProduction ? 'v1' : 'api/v1');
// Enable CORS // Enable CORS
app.enableCors({ app.enableCors({