The RPC router group defining all available endpoints.
An object mapping every endpoint name to its implementation. All endpoints are required.
Configuration object
Configuration object for the RPC handler. This is used to provide the service layers, serialization, and additional layers.
Optional
additionalLayers?: Layer.Layer<any, any, never>[]Additional Layer instances to merge into the environment. This can be used to provide additional dependencies required by the handlers, such as authentication middleware or other services. This is optional and can be omitted or an empty array if no additional layers are needed.
Optional
serialization?: SerializationLayerThe serialization layer to use for RPC communication.
Defaults to RpcSerialization.layerNdjson
.
Must be of type SerializationLayer.
If you use a custom serialization layer, make sure it is compatible with the RPC server you are communicating with.
This means, you most likely want to modify the createEffectRPC function invocation to use the same serialization layer!
The Layer providing all dependencies required by the handlers (e.g., service implementations). This is typically the default service layer for the service being used.
A function that takes a Request
(and optional context) and returns a Promise<Response>
.
Creates a web-compatible handler that combines route implementations and server setup in one function.
This is a convenience function that internally calls both createRouteHandler and createServerHandler to provide a streamlined API for creating RPC handlers.