Hi
We have a proxy with a Node Target. Node Target URL will hit another API endpoint say n number of times with different parameters and collate the response.
Based on different environments (prod, dev, qa etc. ) the IP address/host that the API hit will change though relative path remain the same.
We want to use configurations
We came across two approaches to handle the same -
a. Store the hostname/IP as a KVM property and retrieve the same in Node JS ( Though we already have the target server defined with the same value so it will be a repetition and have to be done for all environments)
b. Use management api to retrieve the target server information based on environment and organisation information in Node JS.
https://api.enterprise.apigee.com/v1/organizations/a377-eval/environments/prod/targetservers/cms
This will give output like
<code>{ "host": "135.185.15.18", "isEnabled": true, "name": "cms", "port": 80 }
From here we can form a url after extracting the values from JSON above and then use the same in Node JS to form a . target endpoint.
Should we go with a) or b)
Is b) an efficient approach as it introduces an extra call. Is there a way to cache or optimize as the no of calls may be substantial in number. Will it be better to do this in node target or we should use a service callout and then pass the response to node through context variable.
Any inputs are appreciated.
Thanks,
Aakash