| 578 | * @since 4.0.0 |
| 579 | */ |
| 580 | export 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 | |
| 598 | const RouteTypeId = "~effect/http/HttpRouter/Route" |
| 599 | |