main.ts 548 B

1234567891011121314151617181920
  1. import { NestFactory } from '@nestjs/core';
  2. import { AppModule } from './app.module';
  3. import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
  4. async function bootstrap() {
  5. const app = await NestFactory.create(AppModule, {
  6. cors: true,
  7. });
  8. app.setGlobalPrefix('/api/v1');
  9. const config = new DocumentBuilder()
  10. .setTitle('Milvus insight')
  11. .setVersion('1.0')
  12. .build();
  13. const document = SwaggerModule.createDocument(app, config);
  14. SwaggerModule.setup('api', app, document);
  15. await app.listen(3000);
  16. }
  17. bootstrap();