Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion meridian-api/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { ValidationPipe } from '@nestjs/common';
import { ValidationPipe, VersioningType } from '@nestjs/common';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import helmet from 'helmet';
import { DataResponseInterceptor } from './common/interceptors/data-response.interceptor';
Expand Down Expand Up @@ -44,6 +44,16 @@ async function bootstrap() {
credentials: true,
});

// Enable URI-based API versioning (issue #454).
// All existing routes remain accessible at their current paths.
// New routes should declare a @Version('1') decorator and be mounted
// under /api/v1/... for forward compatibility.
app.enableVersioning({
type: VersioningType.URI,
prefix: 'v',
defaultVersion: '1',
});

// Set global validation pipes. The custom `exceptionFactory` reshapes
// class-validator's flat `message: string[]` response into a structured
// `{ errors: [{ field, message, constraint }] }` shape that the frontend
Expand Down
Loading