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