@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 27 lines 817 Bytes
Raw
1 import { Function } from "@alchemy.run/railway/Function";
2 import { enableRailwayRpc } from "@alchemy.run/railway/rpc-server";
3 import * as Effect from "effect/Effect";
4 import * as HttpServerResponse from "effect/http/HttpServerResponse";
5 import { Partition, Site } from "./rpc-shared.ts";
6
7 export { Site };
8
9 /**
10 * Tagged Function that hosts a schemaless `greet` method. RPC is served
11 * only on `{name}.railway.internal` with `ALCHEMY_RPC_TOKEN`.
12 */
13 export default class Greeter extends Function<Greeter>()(
14 "Greeter",
15 {
16 project: Site,
17 environment: Partition,
18 main: import.meta.url,
19 },
20 Effect.gen(function* () {
21 enableRailwayRpc();
22 return {
23 greet: (name: string) => Effect.succeed(`hello ${name}`),
24 fetch: Effect.succeed(HttpServerResponse.text("greeter")),
25 };
26 }),
27 ) {}