From a9864d68516ac0194fbe1b8d91ac6b98cd241c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Fri, 12 Jul 2024 03:16:50 +0200 Subject: [PATCH] Stream test --- packages/server/src/index.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index daf60ee..230993d 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -1,6 +1,6 @@ import { BunRuntime } from "@effect/platform-bun" import { Todo } from "@todo-tests/common/data" -import { Effect, Layer, Option } from "effect" +import { Duration, Effect, Layer, Option } from "effect" import { Services } from "./Services" import { ExpressApp } from "./http/ExpressApp" import { ExpressHTTPServer } from "./http/ExpressHTTPServer" @@ -64,6 +64,20 @@ const main = Effect.gen(function*() { updatedAt: new Date(), })) + yield* Effect.fork( + todos.add(new Todo({ + id: Option.none(), + order: 1, + content: "Clean the pool", + due: Option.none(), + completed: false, + createdAt: new Date(), + updatedAt: new Date(), + })).pipe( + Effect.delay(Duration.seconds(5)) + ) + ) + yield* Layer.launch(ServerDev) })