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

33 lines
962 B
TypeScript

import * as Lambda from "@/AWS/Lambda";
import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
import { HttpServerRequest } from "effect/http/HttpServerRequest";
import * as HttpServerResponse from "effect/http/HttpServerResponse";
const main = import.meta.url;
/** ALB Lambda target answering the `/web/*` path rule. */
export class WebTargetFunction extends Lambda.Function<Lambda.Function>()(
"WebTargetFunction",
) {}
export const WebTargetFunctionLive = WebTargetFunction.make(
{
main,
timeout: Duration.seconds(30),
},
Effect.gen(function* () {
return {
fetch: Effect.gen(function* () {
const request = yield* HttpServerRequest;
const pathname = new URL(request.originalUrl).pathname;
return yield* HttpServerResponse.json({
target: "web",
path: pathname,
});
}).pipe(Effect.orDie),
};
}),
);
export default WebTargetFunctionLive;