THRIFT-2398:Improve Node Server Library
CLIENT: node
Patch: Randy Abernethy
Update node hello web example and line ending clean up.
diff --git a/lib/nodejs/examples/hello.js b/lib/nodejs/examples/hello.js
index 90634c9..8b7c4e4 100644
--- a/lib/nodejs/examples/hello.js
+++ b/lib/nodejs/examples/hello.js
@@ -17,8 +17,6 @@
* under the License.
*/
var thrift = require('thrift');
-var TBufferedTransport = require('thrift/transport').TBufferedTransport;
-var TJSONProtocol = require('thrift/protocol').TJSONProtocol;
var HelloSvc = require('./gen-nodejs/HelloSvc.js');
var TimesTwoSvc = require('./gen-nodejs/TimesTwo.js');
@@ -38,28 +36,28 @@
}
var helloService = {
- transport: TBufferedTransport,
- protocol: TJSONProtocol,
- cls: HelloSvc,
+ transport: thrift.TBufferedTransport,
+ protocol: thrift.TJSONProtocol,
+ processor: HelloSvc,
handler: helloHandler
};
var dblService = {
- transport: TBufferedTransport,
- protocol: TJSONProtocol,
- cls: TimesTwoSvc,
+ transport: thrift.TBufferedTransport,
+ protocol: thrift.TJSONProtocol,
+ processor: TimesTwoSvc,
handler: timesTwoHandler
};
-var StaticHttpThriftServerOptions = {
- staticFilePath: ".",
+var ServerOptions = {
+ files: ".",
services: {
"/hello": helloService,
"/dbl": dblService,
}
}
-var server = thrift.createStaticHttpThriftServer(StaticHttpThriftServerOptions);
+var server = thrift.createWebServer(ServerOptions);
var port = 8585;
server.listen(port);
console.log("Http/Thrift Server running on port: " + port);