客户端路由不会同步到服务端路由

This commit is contained in:
CrescentLeaf
2025-12-07 00:47:15 +08:00
parent 4788434445
commit e3db26323b

View File

@@ -33,6 +33,17 @@ export default async function createLingChairServer() {
res.sendFile(path.resolve(file!.getFilePath()))
file.updateLastUsedTime()
})
// For client-side router
app.get(/.*/, (req, res, next) => {
if (
req.path.startsWith('/uploaded_files/')
|| req.path === '/config.json'
) {
return next()
}
res.sendFile(path.resolve(config.data_path + '/page_compiled/index.html'))
})
await fs.mkdir(config.data_path + '/upload_cache', { recursive: true })
try {