Dev proxy targets the live API by default (no local backend needed)

npm run dev now proxies /api to https://upbeatbytes.com so the dev frontend
works standalone. Override with GOODNEWS_DEV_API=http://127.0.0.1:8000 to test a
local backend.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay
2026-06-01 17:53:25 +00:00
parent c6d37039a8
commit c7f4db3973
+8 -2
View File
@@ -1,7 +1,13 @@
import { sveltekit } from '@sveltejs/kit/vite';
// Dev API target. Defaults to the live API so `npm run dev` works on its own
// (no local backend to run). To test LOCAL backend changes, start a host API
// (`goodnews serve --port 8000`) and run:
// GOODNEWS_DEV_API=http://127.0.0.1:8000 npm run dev
const API = process.env.GOODNEWS_DEV_API || 'https://upbeatbytes.com';
const proxy = { target: API, changeOrigin: true, secure: true };
export default {
plugins: [sveltekit()],
// Dev convenience: proxy API calls to the FastAPI server.
server: { proxy: { '/api': 'http://127.0.0.1:8000', '/healthz': 'http://127.0.0.1:8000' } },
server: { proxy: { '/api': proxy, '/healthz': proxy } },
};