diff --git a/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx b/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx index dd45ad0..32a61fe 100644 --- a/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx +++ b/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx @@ -27,7 +27,6 @@ function SubjectPage(){ test() },[]) - const [EndTestList,setEndTestList]=useState([]) //获取他已经做过的试卷 const end_test=async()=>{ diff --git a/app-dm/src/setupProxy.js b/app-dm/src/setupProxy.js index 57c0f6f..d5f0756 100644 --- a/app-dm/src/setupProxy.js +++ b/app-dm/src/setupProxy.js @@ -1,4 +1,11 @@ -const proxy=require("http-proxy-middleware") -module.exports=function(app){ - app.use(proxy(['/api'],{target:"http://localhost:5000"})) -} \ No newline at end of file +const { createProxyMiddleware } = require('http-proxy-middleware'); + +module.exports = function(app) { + app.use( + '/api', // 如果请求路径匹配'/api',则进行代理 + createProxyMiddleware({ + target: 'http://localhost:5000', // 目标后端服务地址 + changeOrigin: true, + }) + ); +}; \ No newline at end of file