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

main
ts 15 lines 553 Bytes
Raw
1 interface Fetcher {
2 fetch(request: Request): Promise<Response>;
3 }
4
5 /**
6 * The app's Worker: the foldkit build, plus `/api` (better-auth's routes and
7 * the NotesApi) forwarded to the Notes Worker. One origin for both, so the
8 * session cookie is first-party and reaches every call and watch.
9 */
10 export default {
11 fetch(request: Request, env: { readonly ASSETS: Fetcher; readonly NOTES: Fetcher }) {
12 const { pathname } = new URL(request.url);
13 return pathname.startsWith("/api") ? env.NOTES.fetch(request) : env.ASSETS.fetch(request);
14 },
15 };