@@ -2,7 +2,7 @@ import * as dotenv from 'dotenv';
2
2
import * as express from 'express' ;
3
3
4
4
import { DocumentBuilder , SwaggerModule } from '@nestjs/swagger' ;
5
- import { Logger , ValidationPipe } from '@nestjs/common' ;
5
+ import { Logger , ValidationPipe , VERSION_NEUTRAL , VersioningType } from '@nestjs/common' ;
6
6
7
7
import { AppModule } from './app.module' ;
8
8
import { HttpAdapterHost , NestFactory } from '@nestjs/core' ;
@@ -13,6 +13,7 @@ import { getNatsOptions } from '@credebl/common/nats.config';
13
13
import helmet from 'helmet' ;
14
14
import { CommonConstants } from '@credebl/common/common.constant' ;
15
15
import NestjsLoggerServiceAdapter from '@credebl/logger/nestjsLoggerServiceAdapter' ;
16
+ import { NatsInterceptor } from '../../../libs/interceptors/nats.interceptor' ;
16
17
dotenv . config ( ) ;
17
18
18
19
async function bootstrap ( ) : Promise < void > {
@@ -57,6 +58,11 @@ async function bootstrap(): Promise<void> {
57
58
. addServer ( `${ process . env . API_GATEWAY_PROTOCOL } ://${ process . env . API_GATEWAY_HOST } ` )
58
59
. build ( ) ;
59
60
61
+ app . enableVersioning ( {
62
+ type : VersioningType . URI ,
63
+ defaultVersion : [ '1' ]
64
+ } ) ;
65
+
60
66
const document = SwaggerModule . createDocument ( app , options ) ;
61
67
SwaggerModule . setup ( 'api' , app , document ) ;
62
68
const httpAdapter = app . get ( HttpAdapterHost ) ;
@@ -70,6 +76,11 @@ async function bootstrap(): Promise<void> {
70
76
} ) ;
71
77
}
72
78
79
+ app . enableVersioning ( {
80
+ type : VersioningType . URI ,
81
+ defaultVersion : [ '1' , VERSION_NEUTRAL ]
82
+ } ) ;
83
+
73
84
app . use ( express . static ( 'uploadedFiles/holder-profile' ) ) ;
74
85
app . use ( express . static ( 'uploadedFiles/org-logo' ) ) ;
75
86
app . use ( express . static ( 'uploadedFiles/tenant-logo' ) ) ;
@@ -85,6 +96,7 @@ async function bootstrap(): Promise<void> {
85
96
xssFilter : true
86
97
} )
87
98
) ;
99
+ app . useGlobalInterceptors ( new NatsInterceptor ( ) ) ;
88
100
await app . listen ( process . env . API_GATEWAY_PORT , `${ process . env . API_GATEWAY_HOST } ` ) ;
89
101
Logger . log ( `API Gateway is listening on port ${ process . env . API_GATEWAY_PORT } ` ) ;
90
102
}
0 commit comments