1 | 'use static'
|
2 |
|
3 | var grpc = require('grpc')
|
4 | var path = require('path')
|
5 |
|
6 | var PROTO_PATH = path.join(__dirname, '../src/core/provider-gateway.proto')
|
7 | var protobuf = grpc.load(PROTO_PATH).gateway
|
8 | var SERVICE_BINDING = '0.0.0.0:50099'
|
9 |
|
10 | server = new grpc.Server()
|
11 | server.addService(protobuf.ProviderGateway.service, {
|
12 | getClientById: getClientById
|
13 | })
|
14 |
|
15 | server.bind(SERVICE_BINDING, grpc.ServerCredentials.createInsecure())
|
16 | server.start()
|
17 |
|
18 | console.log('Its working: ' + SERVICE_BINDING)
|
19 |
|
20 | function getClientById (call, callback) {
|
21 | console.log(call)
|
22 | callback(null, { client: { objectId: '123', clientName: null }})
|
23 | }
|