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

Function endpoint

packages/effect/src/unstable/httpapi/HttpApiBuilder.ts:435–466  ·  view source on GitHub ↗
(
  api: HttpApi.HttpApi<ApiId, Groups>,
  groupIdentifier: GroupIdentifier,
  endpointIdentifier: EndpointIdentifier,
  handler: NoInfer<
    HttpApiEndpoint.HandlerWithIdentifier<
      HttpApiGroup.Endpoints<HttpApiGroup.WithIdentifier<Groups, GroupIdentifier>>,
      EndpointIdentifier,
      never,
      R
    >
  >
)

Source from the content-addressed store, hash-verified

433 * @since 4.0.0
434 */
435export const endpoint = <
436 ApiId extends string,
437 Groups extends HttpApiGroup.Constraint,
438 const GroupIdentifier extends HttpApiGroup.Identifier<Groups>,
439 const EndpointIdentifier extends HttpApiGroup.Endpoints<
440 HttpApiGroup.WithIdentifier<Groups, GroupIdentifier>
441 >["identifier"],
442 R
443>(
444 api: HttpApi.HttpApi<ApiId, Groups>,
445 groupIdentifier: GroupIdentifier,
446 endpointIdentifier: EndpointIdentifier,
447 handler: NoInfer<
448 HttpApiEndpoint.HandlerWithIdentifier<
449 HttpApiGroup.Endpoints<HttpApiGroup.WithIdentifier<Groups, GroupIdentifier>>,
450 EndpointIdentifier,
451 never,
452 R
453 >
454 >
455): EndpointReturn<Groups, GroupIdentifier, EndpointIdentifier, R> =>
456 Effect.contextWith((context: Context.Context<any>) => {
457 const group = api.groups[groupIdentifier] as unknown as HttpApiGroup.Top
458 const endpoint = group.endpoints[endpointIdentifier]
459 return Effect.succeed(handlerToHttpEffect(
460 group,
461 endpoint,
462 Context.omit(Scope.Scope)(context),
463 handler as any,
464 false
465 ))
466 })
467
468/**
469 * Decodes credentials for an HTTP API security scheme from the current request,

Callers

nothing calls this directly

Calls 3

handlerToHttpEffectFunction · 0.85
omitMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected