Задача:
- Наш последний учебный проект разбить на микросервисы. Достаточно сделать проект, состоящий только из двух микросервисов - профиль и авториазация. Проект должен:
- запускаться через docker
- у каждого микросервиса должна быть своя отдельная база данных (у одного таблица пользователей, у другого таблица профайла)
- общение микросервисов между собой организовать через rabbitMq
Ход работы:
- npm i -g @nestjs/cli
- nest new api
- cd api
- nest generate app auth
- nest generate app profile
Из nest-cli.json: "monorepo": true - позволяет использовать общий код.
- $ nest g library shared
-
npm i @nestjs/config @nestjs/microservices
-
npm i --save amqplib amqp-connection-manager
-
npm install --save @nestjs/swagger
-
npm install --save @nestjs/sequelize sequelize sequelize-typescript postgresql
-
npm install --save-dev @types/sequelize
-
nest generate app roles
-
nest generate app token
-
nest generate app user
-
npm i --save-dev @types/uuid
-
npm install --save @types/bcryptjs
-
npm cache clean
-
npm install --save-dev @types/sequelize-typescript
-
A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
$ npm install# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:covNest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.