Hyperlinkv0.8.0-beta.28

Node

Node.httpServerfunctionsrc/internal/nodeHttpServer.ts:222
<Serve extends Layer.Layer<never, any, any>>(
  serve: Serve,
  options?: HttpServerOptions
): Layer.Layer<
  Layer.Success<Serve>,
  Layer.Error<Serve>,
  Layer.Services<Serve> | HttpServer.HttpServer
>
(options?: HttpServerOptions): Layer.Layer<
  never,
  never,
  Hyperlink.ServedHyperlinks | HttpServer.HttpServer
>
<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 resources composed with serve — the multi-resource, heterogeneous-dependency counterpart to a single serve layer. Reads the ServedHyperlinks registry, merges every registered group onto one RpcServer at path (default /rpc), and mounts a /health route aggregating each resource's readiness. Because each serve layer carries its own Layer.provided dependency, resources 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.servedHyperlinksLayer, so you list resources 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.servedHyperlinksLayer 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.

serversserveServedHyperlinksHyperlink.servedHyperlinksLayerhttpServer
export function httpServer<Serve extends Layer.Layer<never, any, any>>(
  serve: Serve,
  options?: HttpServerOptions,
): Layer.Layer<
  Layer.Success<Serve>,
  Layer.Error<Serve>,
  Layer.Services<Serve> | HttpServer.HttpServer
>;
export function httpServer(
  options?: HttpServerOptions,
): Layer.Layer<never, never, Hyperlink.ServedHyperlinks | HttpServer.HttpServer>;
export function httpServer<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?:
    | Layer.Layer<never, any, any>
    | ServerServeList
    | ReadonlyArray<Layer.Layer<never, any, any>>
    | HttpServerOptions,
  maybeOptions?: HttpServerOptions,
): Layer.Layer<never, any, any> {
  return serverImpl(Hyperlink.serverProtocolHttp, "Http", servesOrOptions, maybeOptions);
}