【发布时间】:2021-03-08 20:56:35
【问题描述】:
如何在浏览器上使用 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');
【问题讨论】:
标签: javascript grpc grpc-web