首页 > 解决方案 > 没有 vue-cli 的 vue 中 proxy.conf.json 的替代方案?

问题描述

我想在另一个网站上向 api 提出请求。

我知道在 Angular 中你可以有一个类似这样的文件 proxy.conf.json

{
  "/api": {
    "target": "website.com",
    "secure": false,
    "changeOrigin": true,
    "logLevel": "debug"
  }
}

如果我不使用 vue-cli,有没有办法在 vue 中做到这一点?

标签: vue.js

解决方案


最终使用带有 webpack 开发中间件的 express 服务器和express-http-proxy


推荐阅读