This commit is contained in:
黄心宇 2024-04-28 14:35:22 +08:00
parent 6529683482
commit fe1399b437
1 changed files with 0 additions and 14 deletions

View File

@ -49,20 +49,6 @@ app.use(['/api', '/admins', '/attachments', '/oauth', '/competitions'], (req, re
proxy(req, res);
});
// 中间件,用于排除特定的路径
function excludePath(req, res, next) {
// 检查请求的路径是否需要被排除
if (req.path.includes('/build/')) {
// 如果是,直接结束请求,不调用下一个中间件或路由处理器
res.status(404).send('This path is excluded.');
} else {
// 如果不是,继续执行下一个中间件或路由处理器
next();
}
}
// 应用中间件到所有路由
app.use(excludePath);
// 匹配路径匹配到的返回处理后的html没匹配到转发到后端
app.get('*',async function (req,res) {
global.domObj = getDomObj()