13 lines
416 B
TypeScript
13 lines
416 B
TypeScript
import * as Effect from "effect/Effect"
|
|
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient"
|
|
import * as HttpClient from "effect/unstable/http/HttpClient"
|
|
|
|
Effect.gen(function*() {
|
|
const client = yield* HttpClient.HttpClient
|
|
const res = yield* client.get("https://jsonplaceholder.typicode.com/posts/1")
|
|
yield* res.json
|
|
}).pipe(
|
|
Effect.provide(FetchHttpClient.layer),
|
|
Effect.runPromise
|
|
)
|