The RPC router group defining all endpoints.
An object mapping every endpoint name to its implementation. All endpoints are required.
A Layer providing all dependencies required by the handlers (e.g., service implementations).
A Layer suitable for use with createServerHandler.
You can also use the createRPCHandler function for a more streamlined approach that combines route handler creation and server setup.
const handlers = createRouteHandler(router, {
SayHelloReq: ({ name }) => HelloService.sayHello(name),
SayByeReq: ({ name }) => HelloService.sayBye(name),
PingPongReq: (req) => HelloService.pingPong(req),
}, HelloService.Default);
// Pass to createServerHandler
export const POST = createServerHandler(router, handlers);
Use createRPCHandler for a more streamlined approach that combines route handler creation and server setup. This function is kept for backward compatibility but will be turned into an internal utility in the next minor version.
Creates a Layer containing all RPC endpoint implementations for a given router.
This function ensures:
additionalLayers
argument