1 import thrift = require("thrift");
2 var program = require('commander');
3 import ThriftTest = require('./gen-nodejs/ThriftTest');
4 import test_handler = require('./test_handler');
8 .option('--port <port>', 'Set thrift server port', 9090)
9 .option('--promise', 'test with promise style functions')
10 .option('--protocol', '"Set thrift protocol (binary) [protocol]"')
13 var port: number = program.port;
15 var options: thrift.ServerOptions = {
16 transport: thrift.TBufferedTransport,
17 protocol: thrift.TBinaryProtocol
20 var server: thrift.Server;
21 if (program.promise) {
22 server = thrift.createServer(ThriftTest.Processor, new test_handler.AsyncThriftTestHandler(), options);
24 server = thrift.createServer(ThriftTest.Processor, new test_handler.SyncThriftTestHandler(), options);