main.ts 754 B

1234567891011121314151617181920212223242526
  1. import { NestFactory } from '@nestjs/core';
  2. import { Logger } from '@nestjs/common';
  3. import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
  4. import { AppModule } from './app.module';
  5. import { json } from 'body-parser';
  6. async function bootstrap() {
  7. const port = 3000;
  8. const app = await NestFactory.create(AppModule, {
  9. cors: true,
  10. });
  11. app.setGlobalPrefix('/api/v1');
  12. const config = new DocumentBuilder()
  13. .setTitle('Milvus insight')
  14. .setVersion('1.0')
  15. .build();
  16. const document = SwaggerModule.createDocument(app, config);
  17. SwaggerModule.setup('api', app, document);
  18. app.use(json({ limit: '150mb' }));
  19. await app.listen(port);
  20. Logger.log(`Milvus insight API server is running on port ${port}`);
  21. }
  22. bootstrap();