#How do I exclude path to global prefix

7 messages · Page 1 of 1 (latest)

wintry ledge
#

I need to exclude a some paths to Healt checks but I have a global prefix in my api like “api/v1”

How do I exclude those paths from my global prefix?

wispy berry
#
imports: [
    ConfigModule,
    MongooseModule.forRootAsync({
      inject: [ConfigService],
      useFactory: async (configService: ConfigService) => configService.getMongoConfig(),
    }),

    ServeStaticModule.forRoot({
      rootPath: join(__dirname, '..', 'uploads'), // Path to the uploads directory
      serveRoot: '/uploads', // Optional: Specify the root URL path for the served files
      exclude: ['/api/v1/*'],
    })
]
#

add exclude to the app.module.ts

#

hope you have great profit

#

🤣

#

as well as

import { ServeStaticModule } from '@nestjs/serve-static';
wintry ledge
#

I don’t know if it’s really the same, but I found that I can make it easier from the same code of:

app.setGlobalPrefix(‘api/v1’, { exclude: [‘/’] });