I've just added @nestjs/swagger to my project, but it ignores the global prefix I've set, even with that option explicitly disabled.
I wonder if there's an order needed for things to work ?
Here's my main.ts file
import { VersioningType } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const config = new DocumentBuilder()
.setTitle('API')
.setDescription('API description')
.setVersion('1.0')
.build();
const document = SwaggerModule.createDocument(app, config, {
ignoreGlobalPrefix: false,
});
SwaggerModule.setup('/api/docs', app, document);
app.enableCors();
app.setGlobalPrefix('/api');
app.enableVersioning({
type: VersioningType.URI,
defaultVersion: '1',
});
await app.listen(3000);
}
bootstrap();