@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, 06:00 UTC

main
ts 19 lines 632 Bytes
Raw
1 import { createFileRoute } from "@tanstack/react-router";
2 import { env } from "cloudflare:workers";
3
4 /**
5 * Same-origin proxy for the browser's `AtomRpc` client. The browser can't use a
6 * Cloudflare service binding directly, so the `AtomRpc` protocol points at this
7 * `/rpc` route and we forward the request body to the private `BACKEND` worker
8 * over the service binding. This keeps the backend off the public internet and
9 * avoids CORS.
10 */
11 export const Route = createFileRoute("/rpc")({
12 server: {
13 handlers: {
14 ANY: async ({ request }) => {
15 return await env.BACKEND.fetch(request);
16 },
17 },
18 },
19 });