last72014-04-20 16:24:48
last7, 2014-04-20 16:24:48

Angular.js and backend will there be code duplication?

I may be wrong in the first place, please correct me if I am. Most of the time I worked with the "standard" HTML / CSS / jQuery + backend, for example on Django. And he adhered to the idea that it didn’t come from the user, it needs to be checked, and then processed (written to the database). For example, let a small jQuery send form check that it was email, and not just a string (so as not to pull the backend on a simple task), but still write code on the backend to make sure that this is soap.
I started to get acquainted with Angular, where it is supposed to bring everything to the frontend and communicate with the server through Rest. That is, will I have to process data from the form both on the front and on the backend or not? Or is everything so safe in Angular and you can safely write to the database right away? That is, if everything is not good, I will have to write two codes in one place, what is the profit then?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Sergey, 2014-04-20
Protko @Fesor

Validation on the server should be. Validation on the client simply downgrades such small requests to the server for validation, and also simplifies the server itself, since only the REST Api needs to be organized. It also increases the quality of the UI itself. But the main thing is that the business logic is not duplicated, usually it is completely closed on the server, and the client only provides a UI for working with data. Although if the application must work offline, duplication will still occur.

vp_arth, 2014-04-20

By validation, nothing changes, the data must be validated, it is mandatory on the server, it is desirable on the client.
Profit in separation, the server part becomes independent (rest), and if the web client ceases to be the only client, they want to make a mobile / desktop application, whatever .. You will not need to make a separate server for this, but for good nothing at all you don't have to add it to the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question