@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 07:15 UTC

main
ts 27 lines 802 Bytes
Raw
1 // Vite's `server.proxy` in front of the Worker under `alchemy dev`. The test
2 // starts a local backend and writes its URL to `backend.json` in its copy of
3 // this fixture.
4 import * as NodeFs from "node:fs";
5 import type { UserConfig } from "vite";
6
7 const { target } = JSON.parse(
8 NodeFs.readFileSync(new URL("./backend.json", import.meta.url), "utf8"),
9 ) as { target: string };
10
11 export default {
12 server: {
13 proxy: {
14 "/api": target,
15 "/backend-ws": { target, ws: true },
16 // Decides asynchronously, after the Worker has answered the upgrade.
17 "/bypass-ws": {
18 target,
19 ws: true,
20 bypass: async () => {
21 await new Promise((resolve) => setTimeout(resolve, 500));
22 return undefined;
23 },
24 },
25 },
26 },
27 } satisfies UserConfig;