]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | import thrift = require("thrift"); |
2 | var program = require('commander'); | |
3 | import ThriftTest = require('./gen-nodejs/ThriftTest'); | |
4 | import test_handler = require('./test_handler'); | |
5 | ||
6 | ||
7 | program | |
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]"') | |
11 | .parse(process.argv); | |
12 | ||
13 | var port: number = program.port; | |
14 | ||
15 | var options: thrift.ServerOptions = { | |
16 | transport: thrift.TBufferedTransport, | |
17 | protocol: thrift.TBinaryProtocol | |
18 | }; | |
19 | ||
20 | var server: thrift.Server; | |
21 | if (program.promise) { | |
22 | server = thrift.createServer(ThriftTest.Processor, new test_handler.AsyncThriftTestHandler(), options); | |
23 | } else { | |
24 | server = thrift.createServer(ThriftTest.Processor, new test_handler.SyncThriftTestHandler(), options); | |
25 | } | |
26 | server.listen(port); |