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

Function provideRequest

packages/effect/src/unstable/http/HttpRouter.ts:1199–1215  ·  view source on GitHub ↗
(layer: Layer.Layer<A2, E2, R2>)

Source from the content-addressed store, hash-verified

1197 */
1198export const provideRequest =
1199 <A2, E2, R2>(layer: Layer.Layer<A2, E2, R2>) =>
1200 <A, E, R>(self: Layer.Layer<A, E, R>): Layer.Layer<
1201 A,
1202 E | E2,
1203 R2 | Exclude<R, Request.From<"Requires", A2>>
1204 > =>
1205 Layer.provide(
1206 self,
1207 middleware<{ provides: A2 }>()(Effect.gen(function*() {
1208 const services = yield* Layer.build(layer as Layer.Layer<A2>)
1209 return (effect) =>
1210 Effect.provideContext(effect, services) as Effect.Effect<
1211 HttpServerResponse.HttpServerResponse,
1212 Types.unhandled
1213 >
1214 })).layer
1215 )
1216
1217/**
1218 * Runs the provided application layer as an HTTP server.

Callers

nothing calls this directly

Calls 3

buildMethod · 0.80
middlewareFunction · 0.70
provideMethod · 0.45

Tested by

no test coverage detected