<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.
export function 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> (+2 overloads)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.
httpServer<function (type parameter) Serve in 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>Serve extends import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never, any, any>>(
serve: Serve extends Layer.Layer<never, any, any>serve: function (type parameter) Serve in 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>Serve,
options: HttpServerOptionsoptions?: HttpServerOptions,
): import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<
import LayerLayer.type Success<T extends Layer.Any> =
T extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _ROut
: never
Extracts the service output type (ROut) from a Layer type.
When to use
Use to derive the services provided by an existing or generic Layer without
restating its ROut type parameter.
Success<function (type parameter) Serve in 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>Serve>,
import LayerLayer.type Error<T extends Layer.Any> =
T extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _E
: never
Extracts the error type (E) from a Layer type.
When to use
Use to derive a layer construction error type for helper types, wrappers, or
APIs that preserve a layer failure channel.
Error<function (type parameter) Serve in 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>Serve>,
import LayerLayer.type Services<T extends Layer.Any> =
T extends infer L
? L extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _RIn
: never
: never
Extracts the service requirements (RIn) from a Layer type.
When to use
Use to derive the dependency requirements of a generic or inferred Layer
without restating its RIn type parameter.
Services<function (type parameter) Serve in 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>Serve> | import HttpServerHttpServer.class HttpServerclass HttpServer {
key: Identifier;
Service: {
serve: { <E, R>(effect: Effect.Effect<HttpServerResponse, E, R>): Effect.Effect<void, never, Exclude<R, HttpServerRequest> | Scope.Scope>; <E, R, App extends Effect.Effect<HttpServerResponse, any, any>>(effect: Effect.Effect<HttpServerResponse, E…;
address: Address;
};
}
Service tag for an HTTP server runtime.
Details
The service can serve an HTTP response effect and exposes the address where the
server is listening.
HttpServer
>;
export function function httpServer(options?: HttpServerOptions): Layer.Layer<never, never, Hyperlink.ServedHyperlinks | HttpServer.HttpServer> (+2 overloads)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.
httpServer(
options: HttpServerOptionsoptions?: HttpServerOptions,
): import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never, never, import HyperlinkHyperlink.type Hyperlink.ServedHyperlinks = /*unresolved*/ anyServedHyperlinks | import HttpServerHttpServer.class HttpServerclass HttpServer {
key: Identifier;
Service: {
serve: { <E, R>(effect: Effect.Effect<HttpServerResponse, E, R>): Effect.Effect<void, never, Exclude<R, HttpServerRequest> | Scope.Scope>; <E, R, App extends Effect.Effect<HttpServerResponse, any, any>>(effect: Effect.Effect<HttpServerResponse, E…;
address: Address;
};
}
Service tag for an HTTP server runtime.
Details
The service can serve an HTTP response effect and exposes the address where the
server is listening.
HttpServer>;
export function 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> (+2 overloads)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.
httpServer<function (type parameter) Serves in httpServer<Serves extends ServerServeList>(serves: Serves, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serves[number]>, Layer.Error<Serves[number]>, Layer.Services<Serves[number]> | HttpServer.HttpServer>Serves extends import ServerServeListServerServeList>(
serves: Serves extends ServerServeListserves: function (type parameter) Serves in httpServer<Serves extends ServerServeList>(serves: Serves, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serves[number]>, Layer.Error<Serves[number]>, Layer.Services<Serves[number]> | HttpServer.HttpServer>Serves,
options: HttpServerOptionsoptions?: HttpServerOptions,
): import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<
import LayerLayer.type Success<T extends Layer.Any> =
T extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _ROut
: never
Extracts the service output type (ROut) from a Layer type.
When to use
Use to derive the services provided by an existing or generic Layer without
restating its ROut type parameter.
Success<function (type parameter) Serves in httpServer<Serves extends ServerServeList>(serves: Serves, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serves[number]>, Layer.Error<Serves[number]>, Layer.Services<Serves[number]> | HttpServer.HttpServer>Serves[number]>,
import LayerLayer.type Error<T extends Layer.Any> =
T extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _E
: never
Extracts the error type (E) from a Layer type.
When to use
Use to derive a layer construction error type for helper types, wrappers, or
APIs that preserve a layer failure channel.
Error<function (type parameter) Serves in httpServer<Serves extends ServerServeList>(serves: Serves, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serves[number]>, Layer.Error<Serves[number]>, Layer.Services<Serves[number]> | HttpServer.HttpServer>Serves[number]>,
import LayerLayer.type Services<T extends Layer.Any> =
T extends infer L
? L extends Layer.Layer<
infer _ROut,
infer _E,
infer _RIn
>
? _RIn
: never
: never
Extracts the service requirements (RIn) from a Layer type.
When to use
Use to derive the dependency requirements of a generic or inferred Layer
without restating its RIn type parameter.
Services<function (type parameter) Serves in httpServer<Serves extends ServerServeList>(serves: Serves, options?: HttpServerOptions): Layer.Layer<Layer.Success<Serves[number]>, Layer.Error<Serves[number]>, Layer.Services<Serves[number]> | HttpServer.HttpServer>Serves[number]> | import HttpServerHttpServer.class HttpServerclass HttpServer {
key: Identifier;
Service: {
serve: { <E, R>(effect: Effect.Effect<HttpServerResponse, E, R>): Effect.Effect<void, never, Exclude<R, HttpServerRequest> | Scope.Scope>; <E, R, App extends Effect.Effect<HttpServerResponse, any, any>>(effect: Effect.Effect<HttpServerResponse, E…;
address: Address;
};
}
Service tag for an HTTP server runtime.
Details
The service can serve an HTTP response effect and exposes the address where the
server is listening.
HttpServer
>;
export function 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> (+2 overloads)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.
httpServer(
servesOrOptions: | Layer.Layer<never, any, any>
| ServerServeList
| ReadonlyArray<Layer.Layer<never, any, any>>
| HttpServerOptions
servesOrOptions?:
| import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never, any, any>
| import ServerServeListServerServeList
| interface ReadonlyArray<T>ReadonlyArray<import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never, any, any>>
| HttpServerOptions,
maybeOptions: HttpServerOptionsmaybeOptions?: HttpServerOptions,
): import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never, any, any> {
return function serverImpl(
serverProtocol: ServerProtocol,
serverKind: ProtocolKind,
servesOrOptions?:
| Layer.Layer<never, any, any>
| ServerServeList
| ReadonlyArray<Layer.Layer<never, any, any>>
| HttpServerOptions,
maybeOptions?: HttpServerOptions
): Layer.Layer<never, any, any>
serverImpl(import HyperlinkHyperlink.serverProtocolHttp, "Http", servesOrOptions: | Layer.Layer<never, any, any>
| ServerServeList
| ReadonlyArray<Layer.Layer<never, any, any>>
| HttpServerOptions
servesOrOptions, maybeOptions: HttpServerOptionsmaybeOptions);
}