In the Vue project, the list data needs to use the QQ music interface data, but the direct request does not have the host and the referer limit, needs to adopt the way of the back-end proxy. With Axios and Node Express, after implementation in Dev-server.js, restart the project, resulting in interface 404. The code is as follows:
After careful examination, the code is no problem, so in apirouts Console.log () print information, run no printing information, means that there is no running this part of the code. Then think of whether it is Webpack version update, configuration has been caused by the change. So after careful look at the configuration, found that webpack.dev.conf.js really different, the new version of the Devsever directly into the configuration.
Older versions of Webpack.dev.conf.js
New version of Webpack.dev.conf.js
Find the reason, I Baidu looking for a new version of how to configure, and then found the following this article, according to the above method, measured effectively, can obtain data.
Share to everyone: Vue Development request Local data configuration, old version dev-server.js, new version Webpack.dev.conf.js
Other places unchanged, just need to put the code in the Dev-server.js, add to the webpack.dev.conf.js can. The following is my configuration, measured effectively.
Solve a problem, or very rewarding.
Vue Project Axios Request interface, back-end proxy request interface 404, where does the problem occur?