|
|
1 日 前 | |
|---|---|---|
| .. | ||
| .vscode | 1 日 前 | |
| docs | 1 日 前 | |
| factory-env | 1 日 前 | |
| factory-types | 1 日 前 | |
| secrets | 1 日 前 | |
| src | 1 日 前 | |
| static | 1 日 前 | |
| test | 1 日 前 | |
| .dockerignore | 1 日 前 | |
| .eslintrc.js | 1 日 前 | |
| .gitignore | 1 日 前 | |
| .prettierrc | 1 日 前 | |
| Dockerfile | 1 日 前 | |
| README.md | 1 日 前 | |
| nest-cli.json | 1 日 前 | |
| package-lock.json | 1 日 前 | |
| package.json | 1 日 前 | |
| tsconfig.build.json | 1 日 前 | |
| tsconfig.json | 1 日 前 | |
-src
-clients ------------------------------------------- All For App used api, and it's private
-exampleMicroservice --------------------------- Every microservice have a single folder to use
-exampleMicroservice.controller.ts --------- In the position handle http request,and every controller should follow naming convention
-....
-admin ------------------------------------------- All For admin used api, and it's private
-exampleMicroservice --------------------------- Same as clients
-...
-global ------------------------------------------- Clients and admin use together, and it's private too
-exampleMicroservice
-...
-public ------------------------------------------- All public api position
-clients -------------------------------------- clients used public api
-clientsPublic.controller.ts
-clientsPublic.controller.ts
-clientsPublic.controller.ts
-admin -------------------------------------- admin used public api
-adminPublic.controller.ts
-adminPublic.controller.ts
-adminPublic.controller.ts
-common.controller.ts -------------------------- clients and admin public api
-common.controller.ts -------------------------- clients and admin public api
-common.controller.ts -------------------------- clients and admin public api
-app.module.ts
-main.ts
-register.module.ts -------------------------------- For All microservice register
ClientsModule.register([
{
name:'microservice',
transport:Transport.TCP,
options:{
port : 3100
}
}
])
Tip: "name" is same with microservice folder /src/microservice example: If we have a folder "/src/customer", there is all router for customer microservice, then "name" should be 'CUSTOMER' and port is that service port
In src/admin src/clients src/global src/public src/public/clients src/public/admin , every folder have private module, and they controller should register in they module
The best way of create a microservice controller is use nest cli: 'nest g co <name> <path>'
@Module({
imports: [],
controllers: [TestController],
})
constructor(
@Inject('MICROSERVICE_SERVICE') private microservice_client:ClientProxy
) {}
Folder
File have to include type such as: xxxx.module.ts or xxxx.controller.ts
Class name
Microservice register name
Function name
Attributes name
Param name
| Container | Port | TCP Port | Network |
|---|---|---|---|
| MySQL | 3306 | null | Broadcast |
| CDN System | 12300 | null | Broadcast |
| Gateway System | 12000 | null | factory |
| Env Server | 12010 | null | factory |
| Env Center | 12020 | null | factory |
| Customer System | 12110 | 12100 | factory |
| Product System | 12200 | null | factory |
| ShoppingCart System | 12300 | null | factory |
| Multi-Currency System | 12400 | null | factory |
| Email System | 12500 | 12500 | factory |
| ChargeStation System | 12610 | 12600 | factory |
| Reservation System | 12710 | 12700 | factory |
| Promotion System | 12810 | 12800 | factory |
| Payment System | 12910 | 12900 | factory |