t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/Fly/fixtures/rpc-ping.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

28 lines
812 B
TypeScript

import * as Fly from "@/Fly";
import * as Cause from "effect/Cause";
import * as Effect from "effect/Effect";
import * as HttpServerResponse from "effect/http/HttpServerResponse";
import { Ping, Pong } from "./rpc-cycle.ts";
export default Ping.make(
{
main: import.meta.url,
region: "iad",
guest: { cpuKind: "shared", cpus: 1, memoryMb: 256 },
},
Effect.gen(function* () {
const pong = yield* Fly.bindService(Pong);
return {
name: () => Effect.succeed("ping"),
fetch: Effect.gen(function* () {
return HttpServerResponse.text(`ping hears ${yield* pong.name()}`);
}).pipe(
Effect.catchCause((cause) =>
Effect.succeed(
HttpServerResponse.text(Cause.pretty(cause), { status: 502 }),
),
),
),
};
}),
);