@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, 04:45 UTC

main
ts 28 lines 950 Bytes
Raw
1 import * as Cloudflare from "@alchemy.run/cloudflare";
2 import * as Effect from "effect/Effect";
3 import * as HttpApiBuilder from "effect/http-api/HttpApiBuilder";
4 import * as Etag from "effect/http/Etag";
5 import * as HttpPlatform from "effect/http/HttpPlatform";
6 import * as HttpRouter from "effect/http/HttpRouter";
7 import * as Layer from "effect/Layer";
8 import { BackendApi, Greeting } from "./Spec.ts";
9
10 export default class Service extends Cloudflare.Worker<Service>()(
11 "Service",
12 {
13 main: import.meta.url,
14 },
15 Effect.gen(function* () {
16 const helloGroup = HttpApiBuilder.group(BackendApi, "Hello", (handlers) =>
17 handlers.handle("hello", () => Effect.succeed(new Greeting({ message: "Hello World" }))),
18 );
19
20 return {
21 fetch: HttpApiBuilder.layer(BackendApi).pipe(
22 Layer.provide(helloGroup),
23 Layer.provide([HttpPlatform.layer, Etag.layer]),
24 HttpRouter.toHttpEffect,
25 ),
26 };
27 }),
28 ) {}