diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index 3d101d1..fb791a1 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -66,8 +66,13 @@ startBrokerPoller() // Drain the D-05 outbox every 15s: dispatches pending CalDAV writes to Fastmail startOutboxWorker() -// Serve React PWA static assets from ./public (Vite build output) -app.use('/assets/*', serveStatic({ root: './public' })) +// Serve React PWA static assets from ./public (Vite build output). +// MUST serve the whole ./public tree, not just /assets/* — root-level PWA files +// (manifest.webmanifest, sw.js, registerSW.js, workbox-*.js, icon-*.png, +// apple-touch-icon.png) live at the root. serveStatic calls next() when a file +// is not found, so SPA routes fall through to the index.html catch-all below. +// (Registered AFTER /health, /api/*, and /callback, so those win.) +app.use('/*', serveStatic({ root: './public' })) app.get('*', serveStatic({ path: './public/index.html' })) // Only start the HTTP server when this module is run directly (not imported in tests)