Both methods have their own application scenarios. Let’s briefly talk about their respective 优缺点 and 适用场景.
Method 1
node serves as a front-end service to render the page, and the page is written as a back-end template. Use node to interact with the server php.
Advantages:
Friendly to page SEO: The page is well rendered on the server side, which is more beneficial to SEO.
The first screen appears faster: node and php interact, assuming they are deployed on the same machine, it is local communication, the speed is fast, and the corresponding 获取数据-> 渲染页面 -> 返回页面 time is faster than the second option.
Disadvantages:
Two implementations: The same rendering logic may need to be implemented once on the server side and the browser side.
Higher service quality and reliability: The server-side logic is relatively heavy, and the quality and reliability guarantee requirements have gone up.
Applicable scenarios: Such as news portals, blogs, etc.
Method 2
node+react, node as a server only provides services, the page is rendered by the client, and the interaction logic is also written in the react component. The 0DOM operation of react will increase the rendering speed of the page.
Advantages:
Front-end and back-end decoupling: the server is responsible for providing data, and the client is responsible for view rendering, making it more maintainable.
No need to implement it twice: it has been mentioned above and will not be repeated. As for the benefits brought by react itself, I will not expand here.
Disadvantages:
Not friendly to SEO: With this solution, the page returned to the front end is mostly just a skeleton, and the content has not been filled in, so the SEO effect will not be very good.
The first screen rendering speed is slow: React is a big guy. In addition, 加载js(包括react)-> 拉取数据 -> 渲染组件 Compared with option one, the speed is generally slower because there are more network back and forth.
Applicable scenarios: Sites that focus on business operations and have a lot of interactions. Such as management backend and rich client applications.
Both methods have their own application scenarios. Let’s briefly talk about their respective
优缺点
and适用场景
.Method 1
Advantages:
Friendly to page SEO: The page is well rendered on the server side, which is more beneficial to SEO.
The first screen appears faster: node and php interact, assuming they are deployed on the same machine, it is local communication, the speed is fast, and the corresponding
获取数据-> 渲染页面 -> 返回页面
time is faster than the second option.Disadvantages:
Two implementations: The same rendering logic may need to be implemented once on the server side and the browser side.
Higher service quality and reliability: The server-side logic is relatively heavy, and the quality and reliability guarantee requirements have gone up.
Applicable scenarios: Such as news portals, blogs, etc.
Method 2
Advantages:
Front-end and back-end decoupling: the server is responsible for providing data, and the client is responsible for view rendering, making it more maintainable.
No need to implement it twice: it has been mentioned above and will not be repeated. As for the benefits brought by react itself, I will not expand here.
Disadvantages:
Not friendly to SEO: With this solution, the page returned to the front end is mostly just a skeleton, and the content has not been filled in, so the SEO effect will not be very good.
The first screen rendering speed is slow: React is a big guy. In addition,
加载js(包括react)-> 拉取数据 -> 渲染组件
Compared with option one, the speed is generally slower because there are more network back and forth.Applicable scenarios: Sites that focus on business operations and have a lot of interactions. Such as management backend and rich client applications.