From 615058036b8a19626bfea1575d609b32af1443a1 Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Mon, 20 Apr 2020 15:08:28 -0700 Subject: [PATCH] grpc-js: Add "Migrating from grpc" README section --- packages/grpc-js/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/grpc-js/README.md b/packages/grpc-js/README.md index 7d51b5b5..ed993d2f 100644 --- a/packages/grpc-js/README.md +++ b/packages/grpc-js/README.md @@ -21,9 +21,16 @@ npm install @grpc/grpc-js - Connection Keepalives - HTTP Connect support (proxies) - This library does not directly handle `.proto` files. To use `.proto` files with this library we recommend using the `@grpc/proto-loader` package. + ## Migrating from [`grpc`](https://www.npmjs.com/package/grpc) + + `@grpc/grpc-js` is almost a drop-in replacement for `grpc`, but you may need to make a few code changes to use it: + + - If you are currently loading `.proto` files using `grpc.load`, that function is not available in this library. You should instead load your `.proto` files using `@grpc/proto-loader` and load the resulting package definition objects into `@grpc/grpc-js` using `grpc.loadPackageDefinition`. + - If you are currently loading packages generated by `grpc-tools`, you should instead generate your files using the `--generate_package_definitions` option in `grpc-tools`, then load the object exported by the generated file into `@grpc/grpc-js` using `grpc.loadPackageDefinition`. + - If you have a server and you are using `Server#bind` to bind ports, you will need to use `Server#bindAsync` instead. + ## Some Notes on API Guarantees The public API of this library follows semantic versioning, with some caveats: