diff --git a/src/main.ts b/src/main.ts index 37eccd7..40ee308 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,7 @@ import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { ConfigService } from '@nestjs/config'; +import * as fs from 'fs'; import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; import { RequestIdMiddleware } from './shared/middleware/request-id/request-id.middleware'; import { AppLogger } from './shared/logger/logger.service'; @@ -20,6 +21,8 @@ async function bootstrap() { .build(); const document = SwaggerModule.createDocument(app, options); + fs.writeFileSync('./swagger.json', JSON.stringify(document, null, 2)); + SwaggerModule.setup('api', app, document); const configService = app.get(ConfigService); diff --git a/swagger.json b/swagger.json new file mode 100644 index 0000000..8b11fe3 --- /dev/null +++ b/swagger.json @@ -0,0 +1,25 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Nestjs API starter", + "description": "Nestjs API description", + "version": "1.0", + "contact": {} + }, + "tags": [], + "servers": [], + "components": {}, + "paths": { + "/": { + "get": { + "operationId": "AppController_getHello", + "parameters": [], + "responses": { + "200": { + "description": "" + } + } + } + } + } +} \ No newline at end of file