-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update to rules_node using pkg_tar.files attribute * Update example * Update README
- Loading branch information
Showing
9 changed files
with
148 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,19 @@ | ||
load("@org_pubref_rules_node//node:rules.bzl", "node_binary") | ||
|
||
# Server works, but not the the client (for reasons I dont yet | ||
# understand) | ||
|
||
node_binary( | ||
name = "client", | ||
main = "greeter_client.js", | ||
modules = [ | ||
"@npm_protobuf_stack//:modules", | ||
"@npm_grpc//:modules", | ||
], | ||
deps = [ | ||
"//examples/helloworld/proto:node", | ||
"@yarn_modules//:_all_", | ||
], | ||
) | ||
|
||
node_binary( | ||
name = "server", | ||
main = "greeter_server.js", | ||
modules = [ | ||
"@npm_protobuf_stack//:modules", | ||
"@npm_grpc//:modules", | ||
], | ||
deps = [ | ||
"//examples/helloworld/proto:node", | ||
"@yarn_modules//:_all_", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,26 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
const jspb = require('google-protobuf'); | ||
const grpc = require('grpc'); | ||
const messages = require('examples-helloworld-proto-node'); | ||
const services_path = path.dirname(require.resolve('examples-helloworld-proto-node')); | ||
const services = require(services_path + '/helloworld_grpc_pb'); | ||
const messages = require('examples/helloworld/node/api_proto_js').api_pb; | ||
const services = require('examples/helloworld/node/api_proto_js').api_grpc_pb; | ||
|
||
function main() { | ||
console.log("Running main"); | ||
var cred = grpc.credentials.createInsecure() | ||
console.log(cred.constructor.classname) | ||
console.log("grpc.credentials: " + cred) | ||
var client = new services.GreeterClient('localhost:50051', cred); | ||
var client = new services.GreeterClient( | ||
'localhost:50051', | ||
grpc.credentials.createInsecure()); | ||
var request = new messages.HelloRequest(); | ||
var user; | ||
if (process.argv.length >= 3) { | ||
user = process.argv[2]; | ||
} else { | ||
user = 'world'; | ||
} | ||
|
||
request.setName(user); | ||
client.sayHello(request, function(err, response) { | ||
console.log('Greeting:', response.getMessage()); | ||
if (err) { | ||
console.error('Error:', err); | ||
} else { | ||
console.log('Greeting:', response.getMessage()); | ||
} | ||
}); | ||
|
||
|
||
// var user = "Foo"; | ||
// var request = new messages.HelloRequest(); | ||
// request.setName(user); | ||
// console.log("Hello " + request.getName()); | ||
|
||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "rules_protobuf", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"google-protobuf": "3.4.0", | ||
"grpc": "1.6.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters