import { HttpLayerRouter } from '@effect/platform';
import { BunHttpServer, BunRuntime } from '@effect/platform-bun';
import { ApiLive } from '@repo/domain/api-live';
import { Layer } from 'effect';
const HttpLiveRequirements = Layer.mergeAll(
ApiLive,
BunHttpServer.layer({ port: 3000 })
);
const AllRoutes = Layer.mergeAll(ApiLive).pipe(
Layer.provide(
HttpLayerRouter.cors({
allowedOrigins: ['*'],
allowedMethods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
allowedHeaders: ['Content-Type', 'Authorization', 'B3', 'traceparent'],
credentials: true,
})
)
);
export const HttpLive = HttpLayerRouter.serve(AllRoutes).pipe(
Layer.provide(HttpLiveRequirements)
);
BunRuntime.runMain(Layer.launch(HttpLive));
import { HttpLayerRouter } from '@effect/platform';
import { BunHttpServer, BunRuntime } from '@effect/platform-bun';
import { ApiLive } from '@repo/domain/api-live';
import { Layer } from 'effect';
const HttpLiveRequirements = Layer.mergeAll(
ApiLive,
BunHttpServer.layer({ port: 3000 })
);
const AllRoutes = Layer.mergeAll(ApiLive).pipe(
Layer.provide(
HttpLayerRouter.cors({
allowedOrigins: ['*'],
allowedMethods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
allowedHeaders: ['Content-Type', 'Authorization', 'B3', 'traceparent'],
credentials: true,
})
)
);
export const HttpLive = HttpLayerRouter.serve(AllRoutes).pipe(
Layer.provide(HttpLiveRequirements)
);
BunRuntime.runMain(Layer.launch(HttpLive));