NestJs学習シリーズのSwaggerによるインタフェースドキュメントの自動生成
839 ワード
1.インストール依存
2.主入口配置Swagge
main.ts
3.効果
4.ピット
バージョンのため、Swaggeの導入エラーが発生する可能性があります.
5.参考 https://docs.nestjs.com/recip... https://www.bilibili.com/vide...
npm install --save @nestjs/swagger swagger-ui-express
2.主入口配置Swagge
main.ts
import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service';
import { ApiUseTags,ApiOperation } from '@nestjs/swagger';
@Controller()
@ApiUseTags(' ')
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
@ApiOperation({title:' '})
getHello(): string {
return this.appService.getHello();
}
}
3.効果
4.ピット
バージョンのため、Swaggeの導入エラーが発生する可能性があります.
:const app = await NestFactory.create(AppModule)
5.参考