@hapi-corp/backend-common-package
v1.3.4
Published
backend common package
Downloads
59
Readme
Backend common package
CommonModule
Append the
CommonModule.forRoot()into your current module import array. This will allow you to use Guards, Services, etc.
import { CommonModule } from 'backend-common-package';CommonModule.forRoot({
cacheConfig?: { store: example_redisStore },
kafkaConfig?: {
transport: Transport.KAFKA,
options: {
client: {
clientId: process.env.CLIENT_ID,
brokers: [process.env.BROKERS],
},
consumer: {
groupId: process.env.GROUP_ID,
},
},,
}),Guards
Request headers:
key: otp-target-type, value: 'email' or 'phone'key: otp-target, value: '[email protected]' or '+51987654321' for examplekey: otp-new-uuid-for-this-operation, value: 'some random uuid'
import {
SendOperationOtpGuard,
ValidatedOperationOtpGuard,
} from 'backend-common-package';@UseGuards(SendOperationOtpGuard, ValidatedOperationOtpGuard)Service
import { GuardsService } from 'backend-common-package';constructor(
private readonly guardsService: GuardsService,
) {}await this.guardsService.validateOperationOtp(input: {
operationUUID: string;
otp: string;
}),