@@ -80,33 +80,6 @@ async function bootstrap(): Promise<void> {
8080 credentials : true ,
8181 } ) ;
8282
83- // Support requests without the `/api` prefix by adding it automatically.
84- // Routes are registered under /api/* via RouterModule, so this lets both
85- // `/jobs` and `/api/jobs` work without changing controllers.
86- // NOTE: We exclude Swagger paths from rewriting.
87- const swaggerPath = swaggerConfig . path || 'api' ;
88- app . use ( ( req : any , _res , next ) => {
89- if ( typeof req . url === 'string' ) {
90- const urlPath = req . url . split ( '?' ) [ 0 ] ;
91-
92- // Skip if already has /api prefix
93- if ( req . url . startsWith ( '/api' ) ) {
94- return next ( ) ;
95- }
96-
97- // Skip root path, health checks, and other special paths
98- if ( urlPath === '/' || urlPath === '/health' ) {
99- return next ( ) ;
100- }
101-
102- // Add /api prefix to the request
103- const newUrl = `/api${ req . url } ` ;
104- req . url = newUrl ;
105- req . originalUrl = newUrl ;
106- }
107- next ( ) ;
108- } ) ;
109-
11083 // ===================================
11184 // Global Setup
11285 // ===================================
@@ -158,7 +131,7 @@ async function bootstrap(): Promise<void> {
158131 . addBearerAuth ( ) // If you use Bearer token authentication
159132 . build ( ) ;
160133 const document = SwaggerModule . createDocument ( app , options ) ;
161- SwaggerModule . setup ( swaggerConfig . path || 'api/ docs' , app , document ) ;
134+ SwaggerModule . setup ( swaggerConfig . path || 'docs' , app , document ) ;
162135 }
163136
164137 // ===================================
@@ -175,7 +148,7 @@ async function bootstrap(): Promise<void> {
175148 await app . listen ( port , '0.0.0.0' ) ;
176149 console . log ( `🚀 CodeBuilder API is listening on http://localhost:${ port } ` ) ;
177150 if ( swaggerConfig . enabled ) {
178- console . log ( `📚 Swagger Docs available at http://localhost:${ port } /${ swaggerConfig . path || 'api/ docs' } ` ) ;
151+ console . log ( `📚 Swagger Docs available at http://localhost:${ port } /${ swaggerConfig . path || 'docs' } ` ) ;
179152 }
180153}
181154
0 commit comments