import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { CoreConfig } from './config.const';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { NestApplicationOptions } from '@nestjs/common';
async function bootstrap() {
const httpOptions ={
requestCert: false,
rejectUnauthorized: true,
};
const app = await NestFactory.create(AppModule);
const options = new DocumentBuilder()
.addServer(`http://localhost:${CoreConfig.app.port}`)
.setTitle('test UI/AI')
.setDescription('UI meta service')
.setVersion('1.0')
.addTag('test')
.addBearerAuth({type:'http', bearerFormat: 'authorization'})
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('docs', app, document);
app.enableCors();
app.setGlobalPrefix('ui');
await app.listen(CoreConfig.app.port);
}
bootstrap().then();
Run Code Online (Sandbox Code Playgroud)
当我的应用程序使用 …