zhoudw
2022-01-10 3755693be0be520deaf92d566f7e5e00d71fdcf5
bin/app.js
@@ -2,6 +2,7 @@
const { createProxyMiddleware } = require('http-proxy-middleware');
const app = express();
const path = require('path');
const fs = require('fs');
const config = require(path.join(__dirname, '../dist/config'));
// proxy 中间件的选择项
@@ -59,7 +60,10 @@
//     // res.sendFile(path.join(__dirname, '../dist/index.html'));
// });
app.get('*', function(req, res) {
    res.sendFile(path.join(__dirname, '../dist/index.html'));
    const indexPath = config.NODE_ENV == 'production' ? '../dist/prod/index.html' : config.NODE_ENV == 'test' ?
        '../dist/test/index.html' : '../dist/dev/index.html';
    const html = fs.readFileSync(path.resolve(__dirname, indexPath), 'utf-8');
    res.send(html);
});
app.listen(config.APP_SERVER_PORT, '0.0.0.0', function(err) {
    if (err) {