What is the difference between the baseURL of axios inside and the proxyTable of webpack inside? Axios post failed to send parameters to the background.

  node.js, question


Does anyone explain the usage?

This use is different,
The baseUrl will be attached to the axios instance (all instances if global), that is, if the url parameter of get/post is a relative path (such as) /api/c/xx, then baseUrl plus’ /api/c/xx will be executed, and if no baseUrl is specified, then the base plus baseUrl of the address bar inside of the browser will be used.
ProxyTable of webpack inside is a process in which the test environment uses nodejs proxy as the same domain as the front-end page (i.e. browser address bar) in order to avoid cross-domain access under the browser. After specifying proxyTable, axios does not need to specify baseUrl. ProxyTable will proxy baseplus’/apis/c/xx’ to the interface address of [base baseUrl plus’/apis/c/xx’].
Of course, when the project is released, the back-end and front-end also need to be released under the same domain.