UNPKG

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