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

Function handlerToRoute

packages/effect/src/http-api/HttpApiBuilder.ts:1074–1094  ·  view source on GitHub ↗
(
  api: Pick<HttpApi.Top, "annotations">,
  group: HttpApiGroup.Top,
  handler: HandlerRuntime,
  context: Context.Context<any>
)

Source from the content-addressed store, hash-verified

1072 * @internal
1073 */
1074export function handlerToRoute(
1075 api: Pick<HttpApi.Top, "annotations">,
1076 group: HttpApiGroup.Top,
1077 handler: HandlerRuntime,
1078 context: Context.Context<any>
1079): HttpRouter.Route<any, any> {
1080 const endpoint = handler.endpoint
1081 const path = HttpApiPath.toRouterPath(endpoint.path, endpoint.params)
1082 const redactedParams = HttpApi.getEndpointRedactedParams(api, group, endpoint)
1083 return HttpRouter.route(
1084 endpoint.method,
1085 path as HttpRouter.PathInput,
1086 handlerToHttpEffect(api, group, endpoint, context, handler.handler, handler.isRaw),
1087 {
1088 uninterruptible: handler.uninterruptible,
1089 redactedParams: redactedParams.all
1090 ? [...redactedParams.names, ...RedactedPath.allParamNames(path)]
1091 : redactedParams.names
1092 }
1093 )
1094}
1095
1096const applyMiddleware = <Group extends HttpApiGroup.Constraint, A extends Effect.Effect<any, any, any>>(
1097 group: Group,

Callers 1

groupFunction · 0.85

Calls 1

handlerToHttpEffectFunction · 0.85

Tested by

no test coverage detected