Skip to content

Commit eaa2ae2

Browse files
committed
Use @borderless/ts-scripts
1 parent d51505d commit eaa2ae2

File tree

6 files changed

+10853
-8327
lines changed

6 files changed

+10853
-8327
lines changed

.eslintrc.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ The server accepts a dictionary of resolvers.
4242
import { createServer } from "@borderless/json-rpc";
4343

4444
const server = createServer<Methods>({
45-
hello: _ => "Hello World!",
46-
echo: ({ arg }) => arg
45+
hello: (_) => "Hello World!",
46+
echo: ({ arg }) => arg,
4747
});
4848

4949
const res = await server({
5050
jsonrpc: "2.0",
5151
id: "test",
52-
method: "hello"
52+
method: "hello",
5353
}); //=> { jsonrpc: "2.0", id: "test", result: "Hello World!" }
5454
```
5555

@@ -60,32 +60,32 @@ The client accepts a function to `send` the JSON-RPC request.
6060
```ts
6161
import { createClient } from "@borderless/json-rpc";
6262

63-
const client = createClient(async payload => {
63+
const client = createClient(async (payload) => {
6464
const res = await fetch("...", {
6565
method: "POST",
6666
body: JSON.stringify(payload),
6767
headers: {
68-
"Content-Type": "application/json"
69-
}
68+
"Content-Type": "application/json",
69+
},
7070
});
7171

7272
return res.json();
7373
});
7474

7575
const result = await client({
7676
method: "hello",
77-
params: {}
77+
params: {},
7878
}); //=> "Hello World!"
7979

8080
const results = await client.many([
8181
{
8282
method: "hello",
83-
params: {}
83+
params: {},
8484
},
8585
{
8686
method: "echo",
87-
params: { arg: "Test" }
88-
}
87+
params: { arg: "Test" },
88+
},
8989
]); //=> ["Hello World!", "Test"]
9090
```
9191

0 commit comments

Comments
 (0)