Merge pull request 'bug fix,修复build路径判断问题' (#694) from Eeeros/forgeplus-react:gitlink_ssr_head into gitlink_ssr_head

1
This commit is contained in:
Eeeros 2024-04-28 14:39:30 +08:00
commit a5055f7040
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()