Created
June 21, 2024 06:23
-
-
Save fzn0x/400cbf1833c2c38f05dca3d42843d2d4 to your computer and use it in GitHub Desktop.
Generate Swagger from Nest Data Transfer Objects and Routes (@wait what?)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NestFactory } from '@nestjs/core'; | |
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; | |
import { AppModule } from './app.module.js'; | |
async function bootstrap() { | |
const app = await NestFactory.create(AppModule); | |
const config = new DocumentBuilder() | |
.setTitle('Minjem Buku Perpustakaan SMK TI Garuda Nusantara') | |
.setDescription('Minjem Skuy') | |
.setVersion('0.0.1') | |
.addTag('bukuPerpusTIGnc_0.0.1') | |
.build(); | |
const document = SwaggerModule.createDocument(app, config); | |
SwaggerModule.setup('api', app, document); | |
await app.listen(3000); | |
} | |
bootstrap(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment