Two:

  • Traditional Web development model based on server-side rendering
  • A new Web development model based on front and back end separation

Server-side rendering of Web development patterns

The concept of server-side rendering: the HTML page sent by the server to the client is dynamically generated on the server by concatenating strings. Therefore, the client does not need to use techniques such as Ajax to request additional data for the page

Pros and cons of server-side rendering

advantages

  • The front-end takes less time. Because the server is responsible for dynamically generating THE HTML content, the browser simply renders the page directly. Mobile devices, in particular, use less power.
  • Good for SEO. Because the server responds to the complete HTML page content, the crawler is easier to crawl and obtain information, which is more conducive to SEO.

disadvantages

  • Occupies server resources. That is, the server finishes the stitching of THE HTML page content. If there are too many requests, the server will have certain access pressure.
  • It is not conducive to the separation of front and rear ends, and the development efficiency is low. Server-side rendering is not conducive to the efficient development of projects, especially for projects with high front-end complexity.

A Web development pattern that separates the front and back ends

  • Concept of front – and – back – end separation: The development pattern of front – and – back – end separation relies on the widespread use of Ajax technology. In short, a separate Web development model is one in which the back-end only provides the API interface and the front-end uses the Ajax invocation interface.

Advantages and disadvantages of front and rear end separation

  • Good development experience. The front end focuses on UI page development, the back end focuses on API development, and the front end has more options.
  • Good user experience. The wide application of Ajax technology, greatly improve the user experience, can easily achieve local page refresh.
  • Reduces server-side rendering stress. Because the page is ultimately generated in each user’s browser. Disadvantages are not conducive to SEO, because a complete HTML page needs to be completed dynamically on the client, so crawler can not crawl the effective information of the page (solution: using THE SSR (Server Side render) technology of Vue, React and other front-end frameworks can solve SEO problems well)

How to choose a Web development pattern

Blindly choosing which development model to use without talking about the business scenario is rogue

  • For enterprise-level sites, as long as the function is presentation without complex interactions and good SEO is required, then we need to use server rendering
  • And similar background management project, interactivity is strong, do not need to consider SEO, then you can use the front and back end development mode of separation In addition, the specific use what kind of open mode is not absolute, in order to both before and after the page rendering speed and the separation efficiency of the development, some websites using the first screen server rendering + other page before and after the separation of development mode

Transfer from CSDN for notes.