JavaScript-issues with front-end back-end collaboration

Source: Internet
Author: User
Tags sublime text
Suddenly thought of a problem.

Does the frontend run the entire project on its own computer, or is it just the front-end part of the code

If only the front-end part of the code, using the backend interface is not to use the absolute path?

Reply content:

Suddenly thought of a problem.

Does the frontend run the entire project on its own computer, or is it just the front-end part of the code

If only the front-end part of the code, using the backend interface is not to use the absolute path?

At present, the most popular is the front-end separation collaboration development method:

    1. Overall on the front and back of the code is placed in the same project, but in the process of development, the complementary effect;

    2. Pre-development, prioritize requirements, and then define the required interface data;

    3. In the development process, the front end simulates the real environment by simulating the data by the defined interface, and the backend should have the corresponding Restfull interface test tool, which does not need to worry about;

    4. After the self-test is completed, the real back-end interface is called to test the joint.

There are two ways to display a general page
A kind of back-end mode data processing then renders the page, another front-end execution front-end code using JS request data

If you have access to the same project, you can use a relative path, instead of an absolute URI path

We are now in our own computer is basically only the previous section of the Code,
Of course, there are cross-domain issues with server-side communication,
Chrome has a plug-in cors that allows cross-domain use
The path is what you need to tune the server-side code IP address + interface path and so on

Now we are generally engaged in a test server, the front and back end according to the development progress will be written to the module to test server to run the test, so actually written in the local, running on the server, so you will say that every time you want to modify the upload is not very annoying, like sublime text has sftp this plug-in, Automatically modify the upload, so everyone's code in the test server-side unified, test pass, and then transfer the test server code to the master server

The front-end part of the code is written by BasePath, this value is when the project starts to read the configuration file, give him the service side of the address on the line. Cross-domain issues, using cors-filter,java-property-utils in Web. XML Configuration Resolution

  • 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.