@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 28 lines 1000 Bytes
Raw
1 import * as FileSystem from "effect/FileSystem";
2 import * as HttpApiBuilder from "effect/http-api/HttpApiBuilder";
3 import * as Etag from "effect/http/Etag";
4 import * as HttpPlatform from "effect/http/HttpPlatform";
5 import * as HttpRouter from "effect/http/HttpRouter";
6 import * as Layer from "effect/Layer";
7 import * as Path from "effect/Path";
8 import { BackendClient } from "./BackendClient";
9 import { FrontendApi } from "./NextApi";
10 import { FrontendHandlers } from "./NextHandlers";
11
12 const platformLayer = Layer.mergeAll(
13 Etag.layer,
14 HttpPlatform.layer.pipe(Layer.provide(FileSystem.layerNoop({}))),
15 FileSystem.layerNoop({}),
16 Path.layer,
17 );
18
19 const FrontendLive = HttpApiBuilder.layer(FrontendApi).pipe(
20 Layer.provide(FrontendHandlers.pipe(Layer.provide(BackendClient.Default))),
21 Layer.provide(platformLayer),
22 );
23
24 const httpHandler = HttpRouter.toWebHandler(FrontendLive, {
25 disableLogger: true,
26 });
27
28 export const handleApiRequest = (request: Request) => httpHandler.handler(request);