forked from Ynov/ptitspas-ynov-back
added swagger
This commit is contained in:
parent
855d2692c1
commit
e7c1b184ba
11
src/main.ts
11
src/main.ts
@ -1,6 +1,8 @@
|
|||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
|
import { SwaggerModule } from '@nestjs/swagger/dist/swagger-module';
|
||||||
|
import { DocumentBuilder } from '@nestjs/swagger';
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
@ -9,6 +11,15 @@ async function bootstrap() {
|
|||||||
|
|
||||||
const port = configService.get<number>('app.port', 3000);
|
const port = configService.get<number>('app.port', 3000);
|
||||||
app.setGlobalPrefix('api/v1');
|
app.setGlobalPrefix('api/v1');
|
||||||
|
|
||||||
|
const config = new DocumentBuilder()
|
||||||
|
.setTitle("P'titsPas API")
|
||||||
|
.setVersion('1.0.0')
|
||||||
|
.build();
|
||||||
|
|
||||||
|
const document = SwaggerModule.createDocument(app, config);
|
||||||
|
SwaggerModule.setup('api/docs', app, document);
|
||||||
|
|
||||||
await app.listen(port);
|
await app.listen(port);
|
||||||
console.log(`✅ P'titsPas API is running on: ${await app.getUrl()}`);
|
console.log(`✅ P'titsPas API is running on: ${await app.getUrl()}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user