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

补充脚本构建

parent f7b8ad5c
......@@ -59,10 +59,10 @@
"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",
"http-proxy-middleware": "^1.0.5",
"json2ts": "^0.0.7",
"ora": "^4.0.4"
}
......
......@@ -7,22 +7,22 @@
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'
}
const { createProxyMiddleware } = require('http-proxy-middleware')
const port = 4444
// 用于解决刷新后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'))
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