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

Function toHttpEffect

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

Source from the content-addressed store, hash-verified

701 * @since 4.0.0
702 */
703export const toHttpEffect = <A, E, R>(
704 appLayer: Layer.Layer<A, E, R>
705): Effect.Effect<
706 Effect.Effect<
707 HttpServerResponse.HttpServerResponse,
708 Request.Only<"Error", R> | Request.Only<"GlobalError", R> | HttpServerError.HttpServerError,
709 Scope.Scope | HttpServerRequest.HttpServerRequest | Request.Only<"Requires", R> | Request.Only<"GlobalRequires", R>
710 >,
711 Request.Without<E>,
712 Exclude<Request.Without<R>, HttpRouter> | Scope.Scope
713> =>
714 Effect.contextWith((context) =>
715 Effect.map(
716 Layer.buildWithMemoMap(
717 Layer.provideMerge(appLayer, layer),
718 Layer.CurrentMemoMap.forkOrCreate(context, { fresh: [layer] }),
719 Context.get(context, Scope.Scope)
720 ),
721 (context) => Context.get(context, HttpRouter).asHttpEffect()
722 )
723 ) as any
724
725const RouteTypeId = "~effect/http/HttpRouter/Route"
726

Callers

nothing calls this directly

Calls 3

forkOrCreateMethod · 0.80
getMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected