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

Function layerHttpRouter

packages/rpc/src/RpcServer.ts:768–792  ·  view source on GitHub ↗
(options: {
  readonly group: RpcGroup.RpcGroup<Rpcs>
  readonly path: HttpRouter.PathInput
  readonly protocol?: "http" | "websocket" | undefined
  readonly disableTracing?: boolean | undefined
  readonly spanPrefix?: string | undefined
  readonly spanAttributes?: Record<string, unknown> | undefined
  readonly concurrency?: number | "unbounded" | undefined
  readonly disableFatalDefects?: boolean | undefined
})

Source from the content-addressed store, hash-verified

766 * @category protocol
767 */
768export const layerHttpRouter = <Rpcs extends Rpc.Any>(options: {
769 readonly group: RpcGroup.RpcGroup<Rpcs>
770 readonly path: HttpRouter.PathInput
771 readonly protocol?: "http" | "websocket" | undefined
772 readonly disableTracing?: boolean | undefined
773 readonly spanPrefix?: string | undefined
774 readonly spanAttributes?: Record<string, unknown> | undefined
775 readonly concurrency?: number | "unbounded" | undefined
776 readonly disableFatalDefects?: boolean | undefined
777}): Layer.Layer<
778 never,
779 never,
780 | RpcSerialization.RpcSerialization
781 | HttpLayerRouter.HttpRouter
782 | Rpc.ToHandler<Rpcs>
783 | Rpc.Context<Rpcs>
784 | Rpc.Middleware<Rpcs>
785> =>
786 layer(options.group, options).pipe(
787 Layer.provide(
788 options.protocol === "http"
789 ? layerProtocolHttpRouter(options)
790 : layerProtocolWebsocketRouter(options)
791 )
792 )
793
794/**
795 * @since 1.0.0

Callers

nothing calls this directly

Calls 5

layerProtocolHttpRouterFunction · 0.85
layerFunction · 0.70
pipeMethod · 0.65
provideMethod · 0.65

Tested by

no test coverage detected