Добавление Swagger документации в NestJS-mod приложение и генерация REST-клиента для Angular-приложения
Подключение генератора Swagger документации к бэкенду.
Подключение https://www.npmjs.com/package/prisma-class-generator для генерации DTO из Prisma - схемы.
Создание nx библиотеки для работы с бэкендом.
Подкл ючение https://www.npmjs.com/package/@openapitools/openapi-generator-cli для генерации SDK для работы с бэкендом.
1. Устанавливаем все необходимые пакеты
Команды
# Install all need dependencies
npm i --save @nestjs/swagger
# Install all need dev-dependencies
npm i --save-dev prisma-class-generator @openapitools/openapi-generator-cli
# Install all need peer-dependencies
npm i --save class-transformer class-validator
Вывод консоли
$ npm i --save @nestjs/swagger
added 5 packages, removed 1 package, and audited 2512 packages in 14s
300 packages are looking for funding
run `npm fund` for details
17 vulnerabilities (6 moderate, 11 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
$ npm i --save-dev prisma-class-generator @openapitools/openapi-generator-cli
added 50 packages, and audited 2562 packages in 15s
304 packages are looking for funding
run `npm fund` for details
18 vulnerabilities (6 moderate, 12 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
$ npm i --save class-transformer class-validator
added 1 package, removed 1 package, and audited 2768 packages in 9s
331 packages are looking for funding
run `npm fund` for details
18 vulnerabilities (6 moderate, 12 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.