File tree Expand file tree Collapse file tree 3 files changed +16
-17
lines changed
packages/grpc-reflection/example Expand file tree Collapse file tree 3 files changed +16
-17
lines changed Original file line number Diff line number Diff line change 7
7
"google-protobuf" : " ^3.0.0" ,
8
8
"@grpc/grpc-js" : " ^1.8.0" ,
9
9
"@grpc/grpc-js-xds" : " ^1.8.0" ,
10
+ "@grpc/reflection" : " ^1.0.0" ,
10
11
"lodash" : " ^4.6.1" ,
11
12
"minimist" : " ^1.2.0"
12
13
}
Original file line number Diff line number Diff line change
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
+ } ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments