Discuss the front end development model

  node.js, question

There are currently two options:

1.nodeAs a front-end service rendering page, the page is written with a back-end template. Node is used to interact with server php.
2.Node plus reactNode, as a server, only provides services. The page is rendered by the client. The interaction logic is also written in react component. According to react’s 0DOM operation, the rendering speed of the page will be improved.
Please express your own opinions and discuss which of the two development modes is better. Please give the reasons.

Each of the two ways has its own adaptation scene. The following is a brief description of each of them.Advantages and disadvantagesApplicable scenario.

Mode 1

Node renders the page as a front-end service, and the page is written with a back-end template. Node is used to interact with server php.

Advantages

  1. Friendly to page SEO: pages are rendered well on the server side, which is more beneficial to SEO.

  2. The first screen appears faster: node and php interact, assuming they are deployed on the same machine and belong to local communication. The speed is fast, corresponding toGet data-> render page-> return pageThe time is faster than that of scheme 2.

Disadvantages

  1. Two implementations: The same rendering logic may need to be implemented once on the server and once on the browser.

  2. The reliability of service quality is higher: the logic of the service side is relatively heavy, so the requirement of quality reliability assurance goes up.

Applicable scenario: such as news portal, blog, etc.

Mode 2

Node adds react. node, as a server, only provides services. The page is rendered by the client. The interaction logic is also written in react component. The rendering speed of the page will be improved according to 0DOM operation of react.

Advantages

  1. Decoupling of front and back ends: the server is responsible for providing data, while the client is responsible for rendering views, which is more maintainable.

  2. There is no need to implement it twice: it has already been mentioned above and will not be repeated here. As for the benefits of react itself, they will not be expanded here.

Disadvantages

  1. Unfriendly to SEO: In this scheme, the page returned to the front end is mostly a skeleton, and the content has not been filled, so SEO effect will not be very good.

  2. The first screen is slow: react is a big guy. Besides,Load js (including reach)-> pull data-> render componentsCompared with the first scheme, the speed is generally slower because the network has more back and forth.

Applicable scenario: Sites with heavy business operations and more interactions. Such as Content Manage System, rich client applications.