E
E
Egor2020-04-11 21:45:48
Backend
Egor, 2020-04-11 21:45:48

Scope of backend templaters?

As I understand it, template engines (mustache, ejs, twig, etc.) are used to dynamically generate pages, transfer data from the backend to the frontend (for example, if a user profile is loaded, the page will be rendered immediately with its data).

But what does it make sense if all the data can be simply pulled from the frontend through the backend api?
What are the advantages of the first approach and the second?
Or maybe they can/should be combined on one site? In this case, for which tasks is the first approach better, and for which the second?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2020-04-11
@witaway

1. You can combine
2. You can not combine.
3. The benefits of giving back - everything is ready, no need to wait or force yourself on the leg, setting up the prerender, for example.
4. Security: everything that lies in the front is visible to anyone, everything that is in the logic of the template engine or back is not visible to anyone, even when it is rendered.
5. Not relevant for SPA on the REST API (I'm a bit shy).
Etc. inflowing and outflowing consequences.
Comparing back-templaters by the principle of their action with the front, IMHO, is not the healthiest idea, since they work differently.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question