diff --git a/src/server/app.ts b/src/server/app.ts index eac1fa8..f6a0d59 100644 --- a/src/server/app.ts +++ b/src/server/app.ts @@ -71,4 +71,15 @@ app.get('/health', (req, res) => { res.json({ status: 'ok', timestamp: new Date() }); }); +// Serve frontend static files +const clientPath = path.join(process.cwd(), 'dist', 'client'); +if (fs.existsSync(clientPath)) { + app.use(express.static(clientPath)); + app.get('*', (req, res) => { + if (!req.path.startsWith('/api') && !req.path.startsWith('/uploads')) { + res.sendFile(path.join(clientPath, 'index.html')); + } + }); +} + export default app; diff --git a/vite.config.ts b/vite.config.ts index f45af2c..0e8476c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,9 @@ import { VitePWA } from 'vite-plugin-pwa' // https://vite.dev/config/ export default defineConfig({ + build: { + outDir: 'dist/client', + }, plugins: [ react(), VitePWA({