0.0.4 • Published 5 years ago
nest-microservices-common v0.0.4
nest-microservices-common
- A NestJS module for
generator-nest-microservicesyeoman template that offers base controller, services and repositories as well as some interceptors and filters
How to use
- install package with
npm i -S nest-microservices-common - Register the
CommonModuleto your feature modules:
@Module({})
export class AppModule {
static register(config: ConfigOptions): DynamicModule {
return {
module: AppModule,
imports: [
CommonModule.register({ platform: CommonModulePlatform.EXPRESS }),
...
],
};
}
}- Once
CommonModuleis registered, then you can extend theBaseController,BaseService<T>andBaseRepository<T>
export class ExampleController extends BaseController<Example, ExampleService> {
constructor (service: ExampleService, logger: LoggerService) {
super (service, logger);
}
}