Commit f7b8ad5c authored by 前端-许佳敏's avatar 前端-许佳敏

修改api代理

parent 63005bde
......@@ -59,6 +59,7 @@
"clone": "^2.1.2",
"connect-history-api-fallback": "^1.6.0",
"express": "^4.17.1",
"express-http-proxy": "^1.6.2",
"fs-extra": "^9.0.1",
"god-yapi2ts": "^1.6.0",
"gulp": "^4.0.2",
......
......@@ -7,7 +7,13 @@
var express =require("express");
var app =express();
const path = require('path')
const httpProxy = require('express-http-proxy')
const port = 4396
const proxyConfig = {
url: 'http://10.0.0.25',
port: '8100'
}
// 用于解决刷新后404问题
var history = require('connect-history-api-fallback');
......@@ -15,6 +21,8 @@ var history = require('connect-history-api-fallback');
app.use(history());
app.use(express.static('dist'))
app.use('/api',proxy(`${proxyConfig.url}:${proxyConfig.proxy}`))
app.get('/',(req,res)=>{
res.sendFile(path.resolve(__dirname, "../dist/", "index.html")) //设置/ 下访问文件位置
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment