const { createProxyMiddleware } = require("http-proxy-middleware"); module.exports = function (app) { app.use( "/api", // 这是路径模式 createProxyMiddleware({ target: "https://api.soyootech.com/", // 目标服务器地址 changeOrigin: true, pathRewrite: { "^/api": "" }, }) ); };