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

新增proxy

parent 6c9ca0c9
......@@ -50,6 +50,7 @@
"god-yapi2ts": "^1.6.0",
"gulp": "^4.0.2",
"json2ts": "^0.0.7",
"ora": "^4.0.4"
"ora": "^4.0.4",
"http-proxy-middleware": "^1.0.5"
}
}
......@@ -7,10 +7,18 @@
var express =require("express");
var app =express();
const path = require('path')
const port = 4398
const { createProxyMiddleware } = require('http-proxy-middleware')
const port = 4398
// 用于解决刷新后404问题
var history = require('connect-history-api-fallback');
app.use('/api',createProxyMiddleware(
{
target: 'http://10.0.0.25:8100',
changeOrigin: true,
pathRewrite: { '^/api' : '' }
}
))
app.use(history());
app.use(express.static('dist'))
......
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