t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/Railway/fixtures/rpc-greeter.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

27 lines
801 B
TypeScript

import { Function } from "@/Railway/Function.ts";
import { enableRailwayRpc } from "@/Railway/rpc-server.ts";
import * as Effect from "effect/Effect";
import * as HttpServerResponse from "effect/http/HttpServerResponse";
import { Partition, Site } from "./rpc-shared.ts";
export { Site };
/**
* Tagged Function that hosts a schemaless `greet` method. RPC is served
* only on `{name}.railway.internal` with `ALCHEMY_RPC_TOKEN`.
*/
export default class Greeter extends Function<Greeter>()(
"Greeter",
{
project: Site,
environment: Partition,
main: import.meta.url,
},
Effect.gen(function* () {
enableRailwayRpc();
return {
greet: (name: string) => Effect.succeed(`hello ${name}`),
fetch: Effect.succeed(HttpServerResponse.text("greeter")),
};
}),
) {}