effect-io-ai

Package: @effect/platform
Module: HttpLayerRouter

HttpLayerRouter.use

A helper function that is the equivalent of:

import * as HttpLayerRouter from "@effect/platform/HttpLayerRouter"
import * as Effect from "effect/Effect"
import * as Layer from "effect/Layer"

const MyRoute = Layer.scopedDiscard(Effect.gen(function*() {
  const router = yield* HttpLayerRouter.HttpRouter

  // then use `yield* router.add(...)` to add a route
}))

Signature

declare const use: <A, E, R>(f: (router: HttpRouter) => Effect.Effect<A, E, R>) => Layer.Layer<never, E, HttpRouter | Exclude<R, Scope.Scope>>

Source

Since v1.0.0