Sfoglia il codice sorgente

build the swagger documentation

Sven Czarnian 2 anni fa
parent
commit
fced0f7ec5
1 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 10 0
      src/main.ts

+ 10 - 0
src/main.ts

@@ -1,5 +1,6 @@
 import { NestFactory } from '@nestjs/core';
 import { ValidationPipe } from '@nestjs/common';
+import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
 import helmet from 'helmet';
 import { AppModule } from './app.module';
 
@@ -10,6 +11,15 @@ async function bootstrap() {
   app.enableCors();
   app.useGlobalPipes(new ValidationPipe({ whitelist: true }));
 
+  const config = new DocumentBuilder()
+    .setTitle('Arrival MANager')
+    .setDescription('The AMAN Rest-API to plan arrival sequences')
+    .setVersion('0.1.0')
+    .addTag('aman')
+    .build();
+  const document = SwaggerModule.createDocument(app, config);
+  SwaggerModule.setup('api', app, document);
+
   await app.listen(3000);
 }
 bootstrap();