8
In the client-side and server-side separation architecture, it is common to doubt who is responsible for some processing.
On the one hand, processing on the client-side can be beneficial for server-side performance, which takes care of delivering the resource so that it is consumed, formatted and perhaps processed on the front end.
On the other side, the server-side. Putting processing on the server-side has the advantage of scaling and relying on resources managed by the organization itself.
Contextualizing in REST
In the principles of REST architecture, the back end is responsible for the delivery of the resource, for example:
GET vnb.rs/api/produtos/1
{
"nome": "Caneca",
"variações": [
{
"cor": "azul",
"preço": 15.00
},
{
"cor": "vermelha",
"preço": 18.00
}
]
}
If I needed the minimum and maximum value of the variations (from 15.00 to 18.00 reais) of this mug, the person responsible for this calculation would be the front-end or back-end?
What defines what type of data can be processed on the client side?
Interestingly, until a few years ago, information processing was done almost exclusively on the server, as it was difficult for the client to have a machine that could handle the work well. Today we are already in a different reality: even smartphones have the capacity to perform heavy functions, which allows us to pass on much of the responsibility to the client, saving server resources and reducing the cost of the project (#Usetheplatform).
– Woss
I don’t have a complete answer, but one argument to favor server-side Remattering is that search engines will only be able to index your site right if the information is already in HTML.
– Pedro von Hertwig Batista
Interesting your question, @Pedro. Today there is the pre-render of pages, very useful for indexing Single-page Applications. This is the great difficulty for Spas in general.
– vinibrsl
What’s available on the client’s side :) And maybe that’s the answer, except I didn’t understand the question
– Maniero
I believe that in general the more on the client side the better, but there are cases where this can change, if your application is focused on users who do not have very powerful machines, a tool to be used with heavy applications or you are making an internal system for a sustainable company that still uses windows Xp
– Costamilam
I agree with @Guilherme, I think that the level of responsibility regarding processing on the client side depends a lot on the business and the type of application you want to develop. If your system is serving supermarket computers that still have Windows 95, it is good to take the responsibility of processing data from these guys.
– Yago Azedias