Summary of front-end deployment and rendering solutions that separate front-end and back-end

The separation of front-end and back-end is mainly to distinguish the back-end and the front-end. In the past, the front-end code directly threw HTML and static files to the back-end, and the back-end completed the dynamic data interaction. Therefore, the back-end had to write both back-end logic and front-end logic. Data interaction logic.

After the front-end and back-end are separated, the back-end only needs to provide the interface, and the front-end must complete the processing of calling the interface and data interaction. But the deployment is completely different from before. As a person who develops both back-end and front-end, I have summarized three front-end and front-end deployment solutions.

Preface: The explanation content uses Java as an example. Other languages ​​​​will be determined according to their own circumstances.

1. The front-end relies on Nginx for deployment and rendering

Put the front-end compiled dist file into the nginx configuration and use root reference

 shortcoming:

1. Front-end personnel need to learn nginx. If the front-end does not understand nginx, development without this deployment idea will cause development or operation and maintenance to require a lot of time for debugging.

2. When it comes to cross-references, if the development is not standardized, various routing exceptions will occur.

2. Front-end embedded back-end deployment rendering

Put the compiled dist file of the front end into the resource file of the back end, similar to the original one.

Fully rendered by backend

 Disadvantages: Every time the front-end code is modified, the back-end needs to be repackaged, compiled and deployed when it needs to be deployed.

3. Front-end independent deployment, back-end side-loaded rendering

Put the dist file compiled by the front end into the specified location of the server, and then render it by the back end

advantage:

1. The front end can be deployed independently and does not depend on the back end.

2. Front-end and back-end debugging is completed, and no further nginx debugging is required. nginx only needs to proxy the backend

3. Routing exceptions will not be caused by nginx cross-references

Guess you like

Origin blog.csdn.net/Qensq/article/details/131039796