We have a standard web application, and the front-end uses Angular, the back-end is written in Java 7. I noticed that we get a lot of duplicate code. That is, the check is performed on the client side of Angular, but I can not completely trust it, since the user can turn off the check on the client side and just send an email request to the server.
So I have to repeat the same server side validation logic in Java. This is pretty tiring, but I don't know how to avoid it. Perhaps I can write some parts of the back-end with a javascript framework (suppose it is Node.js) that can use the same validation library as the front-end and make Java back-end interact with Node.js? What is the best approach to solve this problem?
source
share