


javascript - I beg the master: How to best cooperate with the front and back ends
Produce dynamic php and jsp pages with data, and the front-end and back-end packaging and publishing are completely independent.
The advantage of this is the performance of the front-end layer. The data is completely controlled by the front-end.
Any problems can be solved independently by the front-end and packaged and released separately.
The packaging and release of front-end and back-end are completely independent. The meaning and understanding of this game
Reply content:
Produce dynamic php and jsp pages with data, and the front-end and back-end packaging and publishing are completely independent.
The advantage of this is the performance of the front-end layer. The data is completely controlled by the front-end.
Any problems can be solved independently by the front-end and packaged and released separately.
The packaging and release of front-end and back-end are completely independent. The meaning and understanding of this game
The front-end and back-end are separated, the front-end is engineered, and all interactions between the front-end and the back-end are through the API. You may think that this is not good for SEO, but now with nodejs, page rendering can be left to the front-end. In fact, this is also a trend. The end-end should care about system availability, performance and other issues, and should not focus on page issues. This part should be left to the front-end.
This blog should be able to help you develop ideas for separate front-end and back-end web development by livoras
First, determine the communication protocol and communication parameters.
Front-end independent jobs can use tools such as mock to simulate background data transmission.
Back-end design uses data models to complete business and generate interfaces.
Personally, I think it is similar to separating the view business such as the template engine in PHP from the project to form an independent front-end version?
The front and back ends interact through API. It doesn't matter whether you use the web front-end or the ios and Android client.
The backend should try to use the same API to meet the needs of multiple front-end pages or even different front-ends. This is the best. The front end needs to know what data is returned by the back end and how it should be rendered according to the design diagram.
A while ago I wrote an article on the steps to develop non-native APP using ionic and cordova on the front end and CoreThink on the back end http://www.oschina.net/question/2598464_2151690?fromerr=mCRfZH2m You can take a look
Simply put, separate the front and back ends through data interfaces (such as ajax requests).
Negative case
I took over a semi-formed web project last year: it was developed in the backend PHP language. I wouldn’t know it without looking at the code. When I looked at the code, I fainted. The code is basically as follows:
<?php ... echo val; ?> <html> <?php echo ...?> </html>
The entire php file contains the flavor of html. I won’t go into details, you should understand. Except for the css file, I threw up. Deeply hurt the heart of OCD. Language can still be used in this way. Once again I felt like I had chosen the wrong path. I thought the world of code could be more organized, but it seems I was wrong.
After thinking about it, I realized that if it was developed in this way, it would be hard enough for one person to cover both the front and back ends. However, this hybrid development model does have an advantage, which is low cost and high efficiency. There are a lot of shortcomings, and expansion and later maintenance are problematic.
Positive Cases
Last year, I also took over a web project. The main requirement: display the content in the background database table. To put it bluntly, it is to imitate the web control of MySQL. But it's simple. But there are requirements: Modeling, that is, by modifying a small number of parameters in the background, you can control the number of tables displayed on the front end, and even the column names of the tables. In other words, all information about the table on the front end is provided by the back end. The front-end only needs to make display adjustments to the interface based on the back-end data.
Design ideas:
1. The style of the table and the dynamic operation of the mouse on the table are used as part of the front-end module;
2. The table name information and list information of the table are returned to json by the ajax request server, and the json can be dynamically created locally by slightly verifying the json locally. Table;
3. Data acquisition also applies to ajax acquisition. Then populate the local table;
4. All local additions, deletions and modifications to data are uploaded to the server through ajax;
The only running-in point is the ajax interface. During development, due to the slowness of the backend, some interfaces passed fake data directly to the frontend through echo
.
Advantages of front-end and back-end separation
Through the development of the data interface model, the front-end and back-end are completely separated, and because this project is a model-based design, the code reuse is very high.
Moreover, if a problem occurs, by detecting the data in the data interface, it is easy to know whether it is a front-end problem or a back-end problem. It is very easy to maintain and even carry out in-depth secondary development.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.

Multiple calls to session_start() will result in warning messages and possible data overwrites. 1) PHP will issue a warning, prompting that the session has been started. 2) It may cause unexpected overwriting of session data. 3) Use session_status() to check the session status to avoid repeated calls.

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

AI can help optimize the use of Composer. Specific methods include: 1. Dependency management optimization: AI analyzes dependencies, recommends the best version combination, and reduces conflicts. 2. Automated code generation: AI generates composer.json files that conform to best practices. 3. Improve code quality: AI detects potential problems, provides optimization suggestions, and improves code quality. These methods are implemented through machine learning and natural language processing technologies to help developers improve efficiency and code quality.

Java's platform independence means that the code written can run on any platform with JVM installed without modification. 1) Java source code is compiled into bytecode, 2) Bytecode is interpreted and executed by the JVM, 3) The JVM provides memory management and garbage collection functions to ensure that the program runs on different operating systems.

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

HTML5 brings five key improvements: 1. Semantic tags improve code clarity and SEO effects; 2. Multimedia support simplifies video and audio embedding; 3. Form enhancement simplifies verification; 4. Offline and local storage improves user experience; 5. Canvas and graphics functions enhance the visualization of web pages.
