mirror of
https://github.com/hanzoai/grpc-web.git
synced 2026-10-30 18:35:37 +00:00
* Migrate grpc-web-node-http-transport package so it's under the @improbable-eng org. on npm. To further disambiguate that this transport is specifically for use with the `@improbable-eng/grpc-web` package. Note I've also fixed an issue with the dependencies; `@improbable-eng/grpc-web` should have been listed as a peer-dependency as it's intended to be used as a plugin (ie: the consumer is expected to have `@improbable-eng/grpc-web` somewhere in their dependency tree) * Mess around with package lock files...
814 B
814 B
@improbable-eng/grpc-web-node-http-transport
Node HTTP Transport for use with @improbable-eng/grpc-web
Usage
When making a gRPC request, specify this transport:
import { grpc } from '@improbable-eng/grpc-web';
import { NodeHttpTransport } from '@improbable-eng/grpc-web-node-http-transport';
grpc.invoke(MyService.DoQuery, {
host: "https://example.com",
transport: NodeHttpTransport(),
/* ... */
})
Alternatively specify the Default Transport when your server/application bootstraps:
import { grpc } from "@improbable-eng/grpc-web";
import { NodeHttpTransport } from "@improbable-eng/grpc-web-node-http-transport";
// Do this first, before you make any grpc requests!
grpc.setDefaultTransport(NodeHttpTransport());