Files
Pre_Seg_Server/server.ts
admin 6f4d4efeaf 统一使用 public logo 资源
- 登录页、侧栏和 favicon 统一引用 public/logo.png 暴露的 /logo.png。

- 删除根目录 logo_square.png 和 Express 中单独提供该文件的路由。

- 同步更新组件测试、项目文档和历史工程分析说明,避免继续引用旧 logo_square。

- 同步整理 ../Seg_Server_Docker 部署包,仅保留 public/logo.png 并更新前端 Docker 构建配置。
2026-05-07 15:51:45 +08:00

32 lines
778 B
TypeScript

import express from "express";
import { createServer as createViteServer } from "vite";
import path from "path";
async function startServer() {
const app = express();
const PORT = 3000;
app.use(express.json());
// Vite middleware for development
if (process.env.NODE_ENV !== "production") {
const vite = await createViteServer({
server: { middlewareMode: true },
appType: "spa",
});
app.use(vite.middlewares);
} else {
const distPath = path.join(process.cwd(), 'dist');
app.use(express.static(distPath));
app.get('*', (req, res) => {
res.sendFile(path.join(distPath, 'index.html'));
});
}
app.listen(PORT, "0.0.0.0", () => {
console.log(`Server running on http://localhost:${PORT}`);
});
}
startServer();