mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
779b9ac2ef
Client: node Patch: Randy Abernethy Clean up of many jshint warnings/errors, jsdoc for HttpConnect, added support for https and Python to HttpConnect, added tests for HttpConnect with https and promises.
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
var thrift = require('thrift');
|
|
var helloSvc = require('./gen-nodejs/HelloSvc');
|
|
|
|
//ServiceHandler: Implement the hello service
|
|
var helloHandler = {
|
|
hello_func: function (result) {
|
|
console.log("Received Hello call");
|
|
result(null, "Hello from Node.js");
|
|
}
|
|
};
|
|
|
|
//ServiceOptions: The I/O stack for the service
|
|
var helloSvcOpt = {
|
|
handler: helloHandler,
|
|
processor: helloSvc,
|
|
protocol: thrift.TJSONProtocol,
|
|
transport: thrift.TBufferedTransport
|
|
};
|
|
|
|
//ServerOptions: Define server features
|
|
var serverOpt = {
|
|
services: {
|
|
"/hello": helloSvcOpt
|
|
}
|
|
}
|
|
|
|
//Create and start the web server
|
|
var port = 9090;
|
|
thrift.createWebServer(serverOpt).listen(port);
|
|
console.log("Http/Thrift Server running on port: " + port);
|
|
|