Vue.js- used proxyTable to forward request to access Douban API,504 error

vue project, there is a cross-domain problem in accessing Douban"s API, using axios. Referring to the method on the Internet, the following configuration is added to the dev of config/index.js

proxyTable: {
      "/api": {
        target: "http://api.douban.com/v2",
        changeOrigin: true,
        pathRewrite: {
          "^/api": ""
        }
      }

    }

the code to send the request is as follows

export default {
  name:"Douban",
  created:function(){
      this.$axios.get("/api/movie/in_theaters")
        .then(function (response) {
            console.log(response);
        })
        .catch(function (error) {
            console.log(error);
        });
  }
}

after npm run dev starts the project, the data cannot be obtained. Browser request 504 error.

Terminal information is as follows

I  Your application is running here: http://localhost:8080
[HPM] Error occurred while trying to proxy request /movie/in_theaters from localhost:8080 to http://api.douban.com/v2 (ENOTFOUND) (https://nodejs.org/api/errors.html-sharperrors_common_system_errors)
Feb.28,2021

after the agent configuration is completed, change the locahost that starts the local service with the local ip startup service. This is some restriction made by the server side

the steps are as follows:

the first step to visit the locahost of the project becomes your local ip
clipboard.png


clipboard.png

clipboard.png

Menu