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

Function provideRequest

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

Source from the content-addressed store, hash-verified

1381 */
1382export const provideRequest =
1383 <A2, E2, R2>(layer: Layer.Layer<A2, E2, R2>) =>
1384 <A, E, R>(self: Layer.Layer<A, E, R>): Layer.Layer<
1385 A,
1386 E | E2,
1387 R2 | Exclude<R, Request.From<"Requires", A2>>
1388 > =>
1389 Layer.provide(
1390 self,
1391 middleware<{ provides: A2 }>()(Effect.gen(function*() {
1392 const services = yield* Layer.build(layer as Layer.Layer<A2>)
1393 return (effect) =>
1394 Effect.provideContext(effect, services) as Effect.Effect<
1395 HttpServerResponse.HttpServerResponse,
1396 Types.unhandled
1397 >
1398 })).layer
1399 )
1400
1401/**
1402 * Runs the provided application layer as an HTTP server.

Callers

nothing calls this directly

Calls 3

middlewareFunction · 0.70
buildMethod · 0.65
provideMethod · 0.45

Tested by

no test coverage detected