forked from LesnyRumcajs/grpc_bench
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into reenable-scala
- Loading branch information
Showing
7 changed files
with
83 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Dockerfile |
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,9 @@ | ||
FROM node:stretch-slim | ||
|
||
WORKDIR /app | ||
COPY node_grpcjs_st /app | ||
COPY proto /app/proto | ||
|
||
RUN npm install | ||
|
||
ENTRYPOINT [ "node", "greeter_server.js" ] |
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,57 @@ | ||
/* | ||
* | ||
* Copyright 2015 gRPC authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
var PROTO_PATH = __dirname + '/proto/helloworld/helloworld.proto'; | ||
|
||
var grpc = require('@grpc/grpc-js'); | ||
var protoLoader = require('@grpc/proto-loader'); | ||
var packageDefinition = protoLoader.loadSync( | ||
PROTO_PATH, | ||
{keepCase: true, | ||
longs: String, | ||
enums: String, | ||
defaults: true, | ||
oneofs: true | ||
}); | ||
var hello_proto = grpc.loadPackageDefinition(packageDefinition).helloworld; | ||
|
||
/** | ||
* Implements the SayHello RPC method. | ||
*/ | ||
function sayHello(call, callback) { | ||
callback(null, {message: call.request.name}); | ||
} | ||
|
||
/** | ||
* Starts an RPC server that receives requests for the Greeter service at the | ||
* sample server port | ||
*/ | ||
function main() { | ||
var server = new grpc.Server(); | ||
server.addService(hello_proto.Greeter.service, {sayHello: sayHello}); | ||
server.bindAsync( | ||
'0.0.0.0:50051', | ||
grpc.ServerCredentials.createInsecure(), | ||
(err, port) => { | ||
process.stdout.write("Server started on 50051"); | ||
server.start(); | ||
} | ||
); | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "grpc-examples", | ||
"version": "0.1.0", | ||
"dependencies": { | ||
"@grpc/proto-loader": "^0.1.0", | ||
"async": "^1.5.2", | ||
"google-protobuf": "^3.0.0", | ||
"@grpc/grpc-js": "^1.1.3", | ||
"lodash": "^4.6.1", | ||
"minimist": "^1.2.0" | ||
} | ||
} |