Modules
Module is the key for microservices approach

Overview

SugoiJS support modular approach for easy migration to micro-services architecture. Therefore, for using SugoiJS server you should define at least one module - the bootstrap module.

Setting a Module

Creating a module requires you to create a class with @ServerModule decorator on it .
The @ServerModule, retrieve an object of the following structure:
{ controllers?:Object[], services?:Object[], modules?: Object[] }
Those property will later be use for declaring the module controllers,services and sub-modules.

Example:

1
import {ServerModule} from "@sugoi/server"
2
3
@ServerModule({
4
controllers:[CoreController],
5
services: [CoreService],
6
modules:[LoginModule,DashboardModule]
7
})
8
export class BootstrapModule{
9
constructor(){}
10
}
Copied!
Last modified 2yr ago