]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/nodejs/examples/httpServer.js
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / thrift / lib / nodejs / examples / httpServer.js
1 var thrift = require('thrift');
2 var helloSvc = require('./gen-nodejs/HelloSvc');
3
4 //ServiceHandler: Implement the hello service
5 var helloHandler = {
6 hello_func: function (result) {
7 console.log("Received Hello call");
8 result(null, "Hello from Node.js");
9 }
10 };
11
12 //ServiceOptions: The I/O stack for the service
13 var helloSvcOpt = {
14 handler: helloHandler,
15 processor: helloSvc,
16 protocol: thrift.TJSONProtocol,
17 transport: thrift.TBufferedTransport
18 };
19
20 //ServerOptions: Define server features
21 var serverOpt = {
22 services: {
23 "/hello": helloSvcOpt
24 }
25 }
26
27 //Create and start the web server
28 var port = 9090;
29 thrift.createWebServer(serverOpt).listen(port);
30 console.log("Http/Thrift Server running on port: " + port);
31