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:
Overall on the front and back of the code is placed in the same project, but in the process of development, the complementary effect;
Pre-development, prioritize requirements, and then define the required interface data;
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;
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