Hyperlinkv0.9.0-beta.0

Node

Node.httpServerfunctionsrc/internal/nodeHttpServer.ts:275
<A, E, R>(
  serve: Layer.Layer<A, E, R>,
  options?: HttpServerOptions
): Layer.Layer<A, E, R | HttpServer.HttpServer>
(options?: HttpServerOptions): Layer.Layer<
  never,
  never,
  Hyperlink.ServedHyperServices | HttpServer.HttpServer
>
<const Serves extends ServerServeList>(
  serves: Serves,
  options?: HttpServerOptions
): Layer.Layer<
  Layer.Success<Serves[number]>,
  Layer.Error<Serves[number]>,
  Layer.Services<Serves[number]> | HttpServer.HttpServer
>

The shared http server for HyperServices composed with serve — the multi-hyperlink, heterogeneous-dependency counterpart to a single serve layer. Reads the ServedHyperServices registry, merges every registered group onto one RpcServer at path (default /rpc), and mounts a /health route aggregating each HyperService's readiness. Because each serve layer carries its own Layer.provided dependency, HyperServices needing different implementations of the same tag stay isolated — no shared union-provide.

Pass the serve layers as the first argument (recommended) — it bundles the provideMerge + Hyperlink.servedHyperServicesLayer, so you list HyperServices and provide only the platform (and any shared dependency):

const Node = Hyperlink.httpServer([
  // homogeneous majority — one shared dependency, stated once
  Hyperlink.provide(ImportHandlers.plain, [
    Hyperlink.serve(SeasonMatches, seasonMatchesImpl),
    Hyperlink.serve(LiveScorePoller, pollerImpl),
  ]),
  // outlier — private dependency, isolated on its own serve layer
  Hyperlink.serve(SeasonImport, importImpl).pipe(Layer.provide(ImportHandlers.hooked)),
], { health: { path: "/health" } }).pipe(
  Layer.provide(NodeHttpServer.layer(() => createServer(), { port })),
);

Prefer this shape over rewriting around a retired bag API: one httpServer, mixed shared + isolated deps, no second port.

The low-level httpServer(options) form requires you to Layer.provideMerge the serve layers (kept, not pruned) + Hyperlink.servedHyperServicesLayer yourself. Either way the handlers ride the context the serve layers provide; if one is missing the RpcServer fails at build (a clear boot error), never a silent runtime gap.

serversserveServedHyperServicesHyperlink.servedHyperServicesLayerhttpServer
export function httpServer<A, E, R>(
  serve: Layer.Layer<A, E, R>,
  options?: HttpServerOptions,
): Layer.Layer<A, E, R | HttpServer.HttpServer>;
export function httpServer(
  options?: HttpServerOptions,
): Layer.Layer<never, never, Hyperlink.ServedHyperServices | HttpServer.HttpServer>;
export function httpServer<const Serves extends ServerServeList>(
  serves: Serves,
  options?: HttpServerOptions,
): Layer.Layer<
  Layer.Success<Serves[number]>,
  Layer.Error<Serves[number]>,
  Layer.Services<Serves[number]> | HttpServer.HttpServer
>;
export function httpServer(
  servesOrOptions?: ServerServeLayer | ServerServeList | HttpServerOptions,
  maybeOptions?: HttpServerOptions,
): Layer.Any {
  return serverImpl(Hyperlink.serverProtocolHttp, "Http", servesOrOptions, maybeOptions);
}