react http-proxy-middleware 跨域处理
作者:互联网
第一步安装依赖
yarn add http-proxy-middleware
第二步在 src 下创建 setupProxy.js 文件
const {createProxyMiddleware} = require('http-proxy-middleware'); module.exports = function(app) { app.use( createProxyMiddleware('/api', { "target": "http://localhost:5000", "changeOrigin": true, } )) }
标签:http,跨域,app,module,createProxyMiddleware,proxy,middleware 来源: https://www.cnblogs.com/fczbk/p/16034041.html