Created
November 10, 2022 15:21
-
-
Save timostamm/6f4200353052fd4a95204a3d6863e4b3 to your computer and use it in GitHub Desktop.
Run a Connect-Web client against the Eliza demo service with Deno
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: v1 | |
plugins: | |
- remote: buf.build/bufbuild/plugins/es | |
out: gen | |
- remote: buf.build/bufbuild/plugins/connect-web | |
out: gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createConnectTransport, createPromiseClient} from "@bufbuild/connect-web"; | |
import {ElizaService} from "./gen/buf/connect/demo/eliza/v1/eliza_connectweb.js"; | |
const client = createPromiseClient(ElizaService, createConnectTransport({ | |
baseUrl: "https://demo.connect.build" | |
})); | |
const res = await client.say({sentence: "hello"}); | |
console.log(res); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"imports": { | |
"@bufbuild/protobuf": "https://cdn.skypack.dev/@bufbuild/protobuf", | |
"@bufbuild/connect-web": "https://cdn.skypack.dev/@bufbuild/connect-web" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: | |
buf generate buf.build/bufbuild/eliza | |
deno lint . | |
deno run --import-map import_map.json --allow-net client.ts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you run
make
, you should see the following output: