I have a legacy Java monolithic web application. My goal is to use React on the frontend, keep Java on the backend and add an API for the frontend to use.
My question is how can I write the data validation just once, using it on both the frontend for form validation and on the backend for data validation?
With the API written in java and the data validation written in javascript, is a workable solution to have an intermediate validation proxy API written in javascript+nodejs which then passes validated requests to the java API?
React(js validation) -> nodejs-API(js validation) -> Java-API(no data validation)