t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/AWS/Lambda/handler.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

34 lines
990 B
TypeScript

import * as Lambda from "@/AWS/Lambda";
import * as Effect from "effect/Effect";
import { HttpServerRequest } from "effect/http/HttpServerRequest";
import * as HttpServerResponse from "effect/http/HttpServerResponse";
const main = import.meta.url;
export class TestFunction extends Lambda.Function<Lambda.Function>()(
"TestFunction",
) {}
export const TestFunctionLive = TestFunction.make(
{
main,
functionUrl: true,
},
Effect.gen(function* () {
return {
fetch: Effect.gen(function* () {
const request = yield* HttpServerRequest;
const pathname = yield* Effect.sync(
() => new URL(request.originalUrl).pathname,
);
if (pathname === "/readiness") {
const marker = yield* Effect.sync(() => process.env.READINESS_MARKER);
return HttpServerResponse.text(marker ?? "missing");
}
return HttpServerResponse.text("Hello, world!");
}),
};
}),
);
export default TestFunctionLive;