Open soon530 opened 2 years ago
nestjs的要先裝。
% yarn add @nestjs/swagger
yarn add v1.22.19
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning " > ts-loader@9.4.1" has unmet peer dependency "webpack@^5.0.0".
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
success Saved 3 new dependencies.
info Direct dependencies
└─ @nestjs/swagger@6.1.3
info All dependencies
├─ @nestjs/mapped-types@1.2.0
├─ @nestjs/swagger@6.1.3
└─ swagger-ui-dist@4.15.1
✨ Done in 4.08s.
然後是expressjs的。
% yarn add swagger-ui-express
yarn add v1.22.19
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning " > ts-loader@9.4.1" has unmet peer dependency "webpack@^5.0.0".
warning " > swagger-ui-express@4.5.0" has unmet peer dependency "express@>=4.0.0".
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ swagger-ui-express@4.5.0
info All dependencies
└─ swagger-ui-express@4.5.0
✨ Done in 9.62s.
可以先來了解一下,之後要開api比較快一點,現在看不出來有沒有遵守openapi的規範。
https://ithelp.ithome.com.tw/articles/10280346 https://docs.nestjs.com/openapi/introduction