Today we have two different domains in our ecosystem. Our BFF should receive informations from those different endpoints.
If I add FirstService and SecondService in providers, both services get the same informations in HttpModule.registerAsync, but I must have two different baseUrl
Module.ts
@Module({
imports: [
HttpModule.registerAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
timeout: 5000,
maxRedirects: 5,
baseURL: configService.get('SERVICE_URL_LEGACY'),
}),
}),
],
providers: [FirstService, SecondService],
controllers: [CampaignsController],
})
export class CampaignsModule {}
Controller must be something like this
Controller
export class CampaignsController {
constructor(
private readonly firstService: FirstService,
private readonly secondService: SecondService,
) {}
@Get('/review')
async getReview() {
const response = await this.firstService.getReview({});
const responseTwo = await this.secondService.getReview({});
}