How the front-end and back-end interact

Source: Internet
Author: User

1. Who will write the front-end request data URL?
In the development, the URL is mainly written by the background, written to the front-end developers. If the background in the query data, need to use query conditions to query the front-end needs of the data, then the background will require the front-end to provide relevant query parameters, where the query parameter is the URL request parameters.

2. Who will write the main interface documents?
Interface documents are mainly written by the background developers, because the direct contact with the data is the background, the background is the most clear, what data in the database, what data can be returned. Front-end development is only the passive recipient of data. So the interface document is mainly done by the background, the front end is only the user of the interface document, The use of the process, found that the returned data is not correct, you need to consult with the background, the background to modify. Remember that the front end does not change the interface documentation, except in the case of a background developer's consent. In general, the interface document mainly by the background to design, modify, front-end developers play an auxiliary role.

3. What is the main data format for front-end development and background interaction?
It's mostly JSON.
XML doesn't use much now.

4. Background interaction principle of front-end development?
At the time of the project, we will probably say the interface address, front-end request parameters, back-end parameters returned, and then everyone began to write, write the same time, we adjust the interface to look at the data returned, no problem on it.

5. Form of the front-end request parameter
Get and post two ways
Easy to use get for not high security
Post is safer than get
Get-gets data from the specified server
POST-submits data to the specified server for processing

6. The front-end should tell the background what valid information, backstage to return to the front-end data?
The content of the page to be displayed is divided into modules, the contents of the module is extracted, and the front-end of some of the flag value, etc., all the desired content and logic to inform the backend,
The backend will go to the database to find the corresponding data table to get the corresponding content, or image address information.
The parameters in the URL are mainly based on the background needs,
If the background requires a parameter as the auxiliary condition for the query, the front end passes the parameters when the URL data is requested.
Before the parameter?
Several parameters in the middle &

7. How can we effectively communicate this information to the backstage, and how does the background get to this data?
Overall: The parameters behind all front-end request URLs are secondary background data queries. If no parameters are required, then the backend will give the URL directly to the front end.

8. How should the front end reject some functional requirements or tasks that are not part of their own?
In dealing with the background, we often encounter this situation, sometimes clearly backstage to deal with an event is very simple, the backstage do not want you to do, at this time we should know to reject him.
Principle: The front end is responsible for displaying the data on the page
Play: This requires that we have a clear understanding of a need, a task, if the task is ambiguous, and you do not understand, you can only be the background at the mercy of the. It will also be criticized for not completing the task.

9. The current end in the call data interface, found that some data is not what we want, then the front-end should do or how to talk to the background?
First of all, the request URL and the returned data as well as the display of the page in the background to see, so well-grounded, background developers will not say what, otherwise, the background will be very impatient, or even scold you may have, itself to do the background is difficult, especially in the query data, data, packaging data are more difficult to deal with.

10. Why do I need to pass parameters at the time of request?
Because the background when querying the database requires a conditional query.

How the front-end and back-end interact

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.