在没有 NodeJS 的情况下使用 GRPC-Web

时间:2021-03-08 20:56:35

标签: javascript grpc grpc-web

如何在浏览器上使用 GRPC-Web? 我的意思是,在纯浏览器代码中,不涉及任何 NodeJS。

来自此处的官方示例:https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/helloworld 主要面向 NodeJS。

有没有办法以纯 Javascript 形式使用 GRPC-Web,而无需:

const {HelloRequest, HelloReply} = require('./helloworld_pb.js');
const {GreeterClient} = require('./helloworld_grpc_web_pb.js');

意思是,只是标准的 <script> 添加 Javascript 依赖项的方式? 并且能够做到:var client = new GreeterClient('http://localhost:8080');

0 个答案:

没有答案