common-nest-plena
v3.0.1
Published
a re-usable and common components used for NestJS projects
Downloads
642
Readme
Description
common-nest-framework for common functionality access the projects. Includes NATS
Usage
- Install the library
npm install common-nest-plena- In
app.module.tsorcron.module.ts(which ever is app factory) add below config.
import { CommonModule } from 'common-nest-plena';
const options = {
enabled: true,
url: process.env.NATS_URL,
healthCheckUrl: '/project-name/health',
};
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
}),
CommonModule.forRoot(options),
// OtherModule,
],
controllers: [],
providers: [],
})
export class AppModule {}- Inject
NatsServiceas a service in Class constructor
import { NatsService } from 'common-nest-plena';
constructor(private nc: NatsService) {}Test
# unit tests
npm run testOther re-usable components
NatsService
Response object to handle API reponses structure
