Skip to content

Instantly share code, notes, and snippets.

@fzn0x
Created June 21, 2024 06:23
Show Gist options
  • Save fzn0x/400cbf1833c2c38f05dca3d42843d2d4 to your computer and use it in GitHub Desktop.
Save fzn0x/400cbf1833c2c38f05dca3d42843d2d4 to your computer and use it in GitHub Desktop.
Generate Swagger from Nest Data Transfer Objects and Routes (@wait what?)
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