Global prefix
To set a prefix for every route registered in an HTTP application, call the setGlobalPrefix() method on the INestApplication instance.
const app = await NestFactory.create(AppModule);
app.setGlobalPrefix('v1');
To exclude routes from the global prefix, use the exclude option:
app.setGlobalPrefix('v1', {
exclude: [{ path: 'health', method: RequestMethod.GET }],
});
Alternatively, you can specify a route as a string, which excludes it for every request method:
app.setGlobalPrefix('v1', { exclude: ['cats'] });
Hint Thepathproperty supports wildcard parameters through the path-to-regexp package. Bare wildcard asterisks (*) are deprecated; use parameters (:param) or named wildcards (*splat) instead. A named wildcard requires at least one extra segment, sohealth/*splatexcludes/health/statusbut not/healthitself. To exclude both, wrap the wildcard in braces:health/{*splat}.

