Vue ssr server rendering problem

vue ssr server rendering problems

problem description

recently read some tutorials on vue ssr server rendering, and now I"ve been wrestling with a problem. If server rendering is done, the backend is not on the render page, but only provides data interface

because when using vue before, a html file will be generated after packaging, and then the html file will be sent to the backend. They will write the address of the html file in the backend render path, so that they can see the html file in the browser, and then the other operations are to access the corresponding interface in the js.

but now that the server is rendered, I don"t really understand whether the server of vue needs "two backends" after rendering. One is used by node to render, and the other is a backend such as python or java, which is used to write

of the data interface.

that is to say, when the project is published and launched, the html pages visited by users are all rendered through the backend (node server), which is no longer the original python, while the other backend (python or java, etc.) is only responsible for returning data
I wonder if what I understand is correct?

Mar.28,2021

1. In essence, the development input of vue is separated from the front and back end, that is, the back end does not need to care about the rendering process of the page, but only provides data, and the rendering of the page is all done by the front-end js. Whether it is java or Python, they only need to provide interfaces and provide data, regardless of how the data is combined with the page
2. Now there is only server rendering because the pages are rendered at the front end, and the front end needs to load html, and then load js, and then request data through js to render the page. This process will be long, resulting in poor user experience, so server rendering appears.
3. The essence of server rendering is to add an intermediate layer between the front-end and back-end interfaces, which requests data, splices html, and returns it to the front-end, so that the front-end can get a complete page that can be displayed with only one request, providing the rendering efficiency of the first screen

.
Menu