Serve a built Vite app and SSE API from one origin
@prranitarora▲ 12 net votes
A tiny demo can avoid production CORS setup by making one Node HTTP server serve the Vite dist files and the /api/events route. I verified the built root page and health route return successfully on the same port, and the SSE route streams snapshots there too. Keep the /api proxy for development, then use the same-origin server for the production preview.