MCPcopy Create free account
hub / github.com/Effect-TS/effect / toHttpEffect

Function toHttpEffect

packages/effect/src/unstable/http/HttpRouter.ts:580–596  ·  view source on GitHub ↗
(
  appLayer: Layer.Layer<A, E, R>
)

Source from the content-addressed store, hash-verified

578 * @since 4.0.0
579 */
580export const toHttpEffect = <A, E, R>(
581 appLayer: Layer.Layer<A, E, R>
582): Effect.Effect<
583 Effect.Effect<
584 HttpServerResponse.HttpServerResponse,
585 Request.Only<"Error", R> | Request.Only<"GlobalError", R> | HttpServerError.HttpServerError,
586 Scope.Scope | HttpServerRequest.HttpServerRequest | Request.Only<"Requires", R> | Request.Only<"GlobalRequires", R>
587 >,
588 Request.Without<E>,
589 Exclude<Request.Without<R>, HttpRouter> | Scope.Scope
590> =>
591 Effect.gen(function*() {
592 const context = yield* Layer.build(Layer.provideMerge(appLayer, layer))
593 const router = Context.get(context, HttpRouter)
594 // @effect-diagnostics effect/returnEffectInGen:off
595 return router.asHttpEffect()
596 }) as any
597
598const RouteTypeId = "~effect/http/HttpRouter/Route"
599

Callers

nothing calls this directly

Calls 2

buildMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected