Skip to content

Commit 4743bfb

Browse files
committed
globap prefix
1 parent cc4124d commit 4743bfb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { ApiModule } from './api/api.module';
88
import { LoggerService } from './shared/modules/global/logger.service';
99
import { Response } from 'express';
1010

11+
const API_PREFIX = '/v6/review'; // Global prefix for all routes in production
12+
1113
async function bootstrap() {
1214
const app = await NestFactory.create<NestExpressApplication>(AppModule, {
1315
rawBody: true,
@@ -17,10 +19,10 @@ async function bootstrap() {
1719
// Create logger instance for application bootstrap
1820
const logger = LoggerService.forRoot('Bootstrap');
1921

20-
// Global prefix for all routes in production is configured as `/v6/review`
22+
// Global prefix for all routes in production
2123
if (process.env.NODE_ENV === 'production') {
22-
app.setGlobalPrefix('/v6/review');
23-
logger.log('Setting global prefix to /v6/review in production mode');
24+
app.setGlobalPrefix(API_PREFIX);
25+
logger.log(`Setting global prefix to ${API_PREFIX} in production mode`);
2426
}
2527

2628
// CORS related settings
@@ -142,7 +144,7 @@ async function bootstrap() {
142144
const document = SwaggerModule.createDocument(app, config, {
143145
include: [ApiModule],
144146
});
145-
SwaggerModule.setup('/v5/review/api-docs', app, document);
147+
SwaggerModule.setup(`${API_PREFIX}/api-docs`, app, document);
146148
logger.log('Swagger documentation configured');
147149

148150
// Add an event handler to log uncaught promise rejections and prevent the server from crashing

0 commit comments

Comments
 (0)