Work
This commit is contained in:
23
packages/server/src/server.ts
Normal file
23
packages/server/src/server.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Effect, flow, Layer, Match } from "effect"
|
||||
import { ServerConfig } from "./config"
|
||||
import { HttpAppLive } from "./http"
|
||||
|
||||
|
||||
const ServerDevelopment = Layer.empty.pipe(
|
||||
Layer.provideMerge(HttpAppLive),
|
||||
)
|
||||
|
||||
const ServerProduction = Layer.empty.pipe(
|
||||
Layer.provideMerge(HttpAppLive),
|
||||
)
|
||||
|
||||
export const Server = ServerConfig.mode.pipe(
|
||||
Effect.map(flow(
|
||||
Match.value,
|
||||
Match.when("development", () => ServerDevelopment),
|
||||
Match.when("production", () => ServerProduction),
|
||||
Match.exhaustive,
|
||||
)),
|
||||
|
||||
Layer.unwrapEffect,
|
||||
)
|
||||
Reference in New Issue
Block a user