const path = require('path');
const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');
// const history = require('connect-history-api-fallback');
const app = express();

// 处理单页应用路由
// app.use(history());

// 代理对象地址
// 读取本地配置的ip

app.use(
  '/video',
  createProxyMiddleware({
    target: 'http://192.168.1.19:5000',
    changeOrigin: true,
    // pathRewrite: {
    //   '^api': '',
    // },
  })
);
// 加载静态资源
app.use(express.static('./dist'));

// 启动服务
app.listen(3001, () => {
  console.log('success => http://localhost:3001');
});
