From 7b35f4d490ada0381f01d048659f8e170bda6c61 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 27 Dec 2024 11:08:59 -0600 Subject: [PATCH] RPC --- rpc.ts | 3 +++ rpcClient.ts | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 rpcClient.ts diff --git a/rpc.ts b/rpc.ts index 1bb325f..bb7cdb3 100644 --- a/rpc.ts +++ b/rpc.ts @@ -25,3 +25,6 @@ export const rpcs = { return toUser(user) }, } + +export type LyricsRPCs = typeof rpcs +export const rpcNames = Object.keys(rpcs) diff --git a/rpcClient.ts b/rpcClient.ts new file mode 100644 index 0000000..f18e02b --- /dev/null +++ b/rpcClient.ts @@ -0,0 +1,7 @@ +import { genCalls } from 'saurpc' +import { LyricsRPCs, rpcNames } from '@lyrics/rpc.ts' + +export const client = genCalls( + rpcNames, + 'http://localhost:8000/api/rpc', +)