Skip to content

Commit 87e1f79

Browse files
committed
docs(grpc-reflection): moved example to common directory and match grpc-go server
1 parent 2449abe commit 87e1f79

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

examples/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"google-protobuf": "^3.0.0",
88
"@grpc/grpc-js": "^1.8.0",
99
"@grpc/grpc-js-xds": "^1.8.0",
10+
"@grpc/reflection": "^1.0.0",
1011
"lodash": "^4.6.1",
1112
"minimist": "^1.2.0"
1213
}

examples/reflection/server.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var path = require('path');
2+
var grpc = require('@grpc/grpc-js');
3+
var protoLoader = require('@grpc/proto-loader');
4+
var reflection = require('@grpc/reflection');
5+
6+
var PROTO_PATH = path.join(__dirname, '../protos/helloworld.proto');
7+
8+
var server = new grpc.Server();
9+
var packageDefinition = protoLoader.loadSync(PROTO_PATH);
10+
var reflection = new reflection.ReflectionService(packageDefinition);
11+
reflection.addToServer(server);
12+
13+
server.bindAsync('localhost:5000', grpc.ServerCredentials.createInsecure(), () => {
14+
server.start();
15+
});

packages/grpc-reflection/example/server.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)