|
I am working in a nodeJS project. It doesn't access the database directly whereas all the required information are retrieved through Rest end points which is hosted in weblogic. I have a requirement to introduce another REST endpoint do a user validation check and validation should happen based on the value in a configuration file. e.g Configuration File will have a property EnableUserNameCheck=True. If the value set to true user validation happens if not it will not be taken place. The reason to introduce this switch is internal implementation of the user validation service has some external dependencies. If these services are down application engineer can make the switch off and allow the users to continue. Question :- As there are two HTTP calls involved, 1) Browser to NodeJS Server 2) NodeJs to RestService in WebLogic, Is it correct to have this configuration value in NodeJS. Then if the value is set to false there is no need to make the Rest Service Call at all. If I include this switch in REST Service then regardless of the switch is ON or OFF Service call have to be made. I want to know whether introducing a custom config value as above is a good practice. What are the disadvantages of having a switch in NodeJS side related to my context Frequency of the config value being changed will be very minimal. If adding a config value to NodeJS is a good approach given the above situation, please direct me to some materials which I can go through |
Thank you for the reply. Yes you are right. NodeJS App exposes a REST Service which in turn calls a Rest Service hosted in Web Logic to do the user validation. In this scenario NodeJS REST endpoint act as a facade. The configuration is added to make the decision whether to do call the Rest Service End Point hosted in Web Logic. The reason is, internal implementation of the end point ( REST in WL) has some external dependencies and if those are not working in production in order reduce the user impact this validation will be switched off. e.g Can add a Key Value pair to a configuration file e.g EnableUserEmailCheck = True.
I can do this validation either in REST end point in WL or NodeJS Rest End Point. I wanted to understand what is the most suitable approach in doing this. Also if adding the config to NodeJS is fine I wanted someone to point me to some material which I can refer in developing that