优化目录结构

This commit is contained in:
2026-05-25 20:37:36 +08:00
parent bbe7e71274
commit 40fd7f7e08
101 changed files with 108 additions and 110 deletions

View File

@@ -219,11 +219,13 @@ export const createServer = (config: Options): express.Express => {
});
});
app.use('/css', express.static(path.join(__dirname, '../client/public/styles')));
app.use('/images', express.static(path.join(__dirname, '../client/public/assets/images')));
app.use(express.static(path.join(__dirname, '../client/public')));
app.use('/module', express.static(path.join(__dirname, '../client/src')));
app.get('/', (_req, res) => {
const indexPagePath = path.join(__dirname, '../client/public/index.html');
app.get(['/', '/index.html'], (_req, res) => {
const indexPagePath = path.join(__dirname, '../client/public/call/index.html');
fs.access(indexPagePath, (err) => {
if (err) {
log(LogLevel.warn, `Can't find file '${indexPagePath}'`);
@@ -235,11 +237,19 @@ export const createServer = (config: Options): express.Express => {
});
});
app.get('/connect/connect.html', (_req, res) => {
res.redirect('/connect/');
});
app.get('/endcall/endcall.html', (_req, res) => {
res.redirect('/endcall/');
});
initSwagger(app, config);
const storage = multer.diskStorage({
destination: (_req: any, _file: any, cb: (error: Error | null, destination: string) => void) => {
const uploadDir = path.join(__dirname, '../client/public/uploads/avatars');
const uploadDir = path.join(__dirname, '../client/public/assets/uploads/avatars');
if (!fs.existsSync(uploadDir)) {
fs.mkdirSync(uploadDir, { recursive: true });
}
@@ -642,7 +652,7 @@ export const createServer = (config: Options): express.Express => {
});
});
app.use('/uploads', express.static(path.join(__dirname, '../client/public/uploads')));
app.use('/uploads', express.static(path.join(__dirname, '../client/public/assets/uploads')));
return app;
};