-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.ts
31 lines (24 loc) · 901 Bytes
/
client.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { getClient, SocialMediaService } from "./deps.ts";
const postProtoPath = new URL("./protos/social_media.proto", import.meta.url);
const postProtoFile = await Deno.readTextFile(postProtoPath);
const clientA = getClient<SocialMediaService>({
port: 50051,
root: postProtoFile,
serviceName: "SocialMediaService",
});
// await clientA
// .GetPosts({})
// .then(data => console.log("All posts", data));
await clientA
.GetTrendingPosts({})
.then(data => console.log("Top 10 trending posts", data));
// await clientA
// .SearchPost({ search: "magna" })
// .then(data => console.log("Search results", data));
// await clientA
// .GetTrendingKeywords({})
// .then((data) => console.log("Top 10 hot keyword", data));
// await clientA
// .RecommendPosts({userId: "665d7484f89adaa511c994c9"})
// .then((data) => console.log("Recommend posts", data));
clientA.close();