Server test
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
import { BunRuntime } from "@effect/platform-bun"
|
||||
import { Todo } from "@todo-tests/common/data"
|
||||
import { Identifiable } from "@todo-tests/common/traits"
|
||||
import { Array, Duration, Effect, Fiber, Layer, Option, Stream } from "effect"
|
||||
import { Array, Duration, Effect, Layer, Option, Stream } from "effect"
|
||||
import { ServicesLive } from "./Services"
|
||||
import { TodoRepository, createDefaultTodos } from "./TodoRepository"
|
||||
import { TRPCEffectRuntimeLive } from "./trpc/TRPCEffectRuntime"
|
||||
import { ExpressApp } from "./express/ExpressApp"
|
||||
import { ExpressHTTPServer } from "./express/ExpressHTTPServer"
|
||||
|
||||
|
||||
const ServerLive = ExpressHTTPServer.Live.pipe(
|
||||
Layer.provide(ExpressApp.Live)
|
||||
)
|
||||
|
||||
|
||||
const watchTodoChanges = Effect.gen(function*() {
|
||||
@@ -24,7 +30,6 @@ const watchTodoChanges = Effect.gen(function*() {
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
const main = Effect.gen(function*() {
|
||||
const watcher = yield* Effect.fork(watchTodoChanges)
|
||||
yield* createDefaultTodos
|
||||
@@ -52,16 +57,14 @@ const main = Effect.gen(function*() {
|
||||
Effect.delay(Duration.seconds(1))
|
||||
)
|
||||
|
||||
yield* Fiber.join(watcher)
|
||||
// yield* Fiber.join(watcher)
|
||||
yield* Layer.launch(ServerLive)
|
||||
})
|
||||
|
||||
const runnableMain = main.pipe(
|
||||
BunRuntime.runMain(main.pipe(
|
||||
Effect.provide(
|
||||
Layer.mergeAll(
|
||||
ServicesLive,
|
||||
TRPCEffectRuntimeLive,
|
||||
ServicesLive
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
BunRuntime.runMain(runnableMain)
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user