The best way to control Claude Code, Codex and more from any computer or phone

main
ts 31 lines 968 Bytes
Raw
1 import * as Lambda from "@alchemy.run/aws/Lambda";
2 import * as Duration from "effect/Duration";
3 import * as Effect from "effect/Effect";
4 import { HttpServerRequest } from "effect/http/HttpServerRequest";
5 import * as HttpServerResponse from "effect/http/HttpServerResponse";
6
7 const main = import.meta.url;
8
9 /** ALB Lambda target answering the `/web/*` path rule. */
10 export class WebTargetFunction extends Lambda.Function<Lambda.Function>()("WebTargetFunction") {}
11
12 export const WebTargetFunctionLive = WebTargetFunction.make(
13 {
14 main,
15 timeout: Duration.seconds(30),
16 },
17 Effect.gen(function* () {
18 return {
19 fetch: Effect.gen(function* () {
20 const request = yield* HttpServerRequest;
21 const pathname = new URL(request.originalUrl).pathname;
22 return yield* HttpServerResponse.json({
23 target: "web",
24 path: pathname,
25 });
26 }).pipe(Effect.orDie),
27 };
28 }),
29 );
30
31 export default WebTargetFunctionLive;