如何在浏览器上使用 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');