22 lines
621 B
TypeScript
22 lines
621 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { AppModule } from './app.module';
|
|
import 'reflect-metadata';
|
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
import * as fs from 'fs';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule);
|
|
app.setGlobalPrefix('api');
|
|
|
|
const config = new DocumentBuilder().build();
|
|
|
|
const document = SwaggerModule.createDocument(app, config, {
|
|
deepScanRoutes: true,
|
|
});
|
|
SwaggerModule.setup('openapi', app, document);
|
|
fs.writeFileSync('./swagger-spec.json', JSON.stringify(document));
|
|
|
|
await app.listen(3000);
|
|
}
|
|
bootstrap();
|