diff --git a/server.js b/server.js index 68ef968..1762ebc 100644 --- a/server.js +++ b/server.js @@ -78,12 +78,22 @@ app.get('/editor', serveEditor); app.use('/api/pages', createPagesRouter()); app.get('/preview/:id', previewPage); -// Placeholder route handlers +// Serve static assets (Vite build outputs) +app.use('/assets', express.static(path.join(__dirname, 'dist', 'assets'))); + +// Route handlers async function serveEditor(req, res) { const indexPath = path.join(__dirname, 'dist', 'frontend', 'index.html'); res.sendFile(indexPath); } +async function serveAssets(req, res) { + // Extract filepath parameter (everything after /assets/) + const filepath = req.params.filepath || req.path.replace('/assets/', ''); + const assetPath = path.join(__dirname, 'dist', 'assets', filepath); + res.sendFile(assetPath); +} + async function previewPage(req, res) { try { const pageId = req.params.id;