mirror of
https://github.com/VibedByKaKi/t3-code-android-nightly.git
synced 2026-10-16 07:17:44 +02:00
34 lines
990 B
TypeScript
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;
|