代理的配置
配置代理:
安装 yarn add http-proxy-middleware
创建文件的路径 src/setupProxy.js
const { createProxyMiddleware } = require('http-proxy-middleware') module.exports = function (app) { app.use('/api', createProxyMiddleware({ target: 'https://cnodejs.org/api/v1', changeOrigin: true, pathRewrite: { "^/api": "/" } } )); }
搞了半天,我还以为我会呢