项目作者: leaves4j

项目描述 :
Egg plugin for thrift
高级语言: JavaScript
项目地址: git://github.com/leaves4j/egg-thrift.git
创建时间: 2017-11-21T01:32:14Z
项目社区:https://github.com/leaves4j/egg-thrift

开源协议:MIT License

下载


egg-thrift

Do not use this package in production, it’s still not finished

NPM version
build status
Test coverage
David deps
Known Vulnerabilities
npm download

TODO

  • compiler
  • watcher
  • thriftType
  • http server
  • http client
  • tcp client
  • test

Install

  1. $ npm i egg-thrift --save

Usage

  1. // {app_root}/config/plugin.js
  2. exports.thrift = {
  3. enable: true,
  4. package: 'egg-thrift',
  5. };

Configuration

  1. // {app_root}/config/config.default.js
  2. exports.thrift = {
  3. package: null,
  4. dir: 'thrift',
  5. compilerOptions: {},
  6. thriftOptions: {
  7. timeout: 5000,
  8. },
  9. defaultClientConfig: {
  10. multiplexed: false,
  11. serviceName: '',
  12. connectType: 'tcp',
  13. host: '127.0.0.1',
  14. port: '80',
  15. options: {
  16. transport: TBufferedTransport,
  17. protocol: TBinaryProtocol,
  18. path: '',
  19. ssl: false,
  20. https: false,
  21. max_attempts: 3,
  22. retry_max_delay: 300,
  23. connect_timeout: 5000,
  24. timeout: 5000,
  25. nodeOptions: {},
  26. headers: {},
  27. },
  28. },
  29. defaultServiceConfig: {
  30. multiplexed: false,
  31. serviceName: '',
  32. connectType: 'tcp',
  33. host: '127.0.0.1',
  34. port: '80',
  35. options: {
  36. transport: TBufferedTransport,
  37. protocol: TBinaryProtocol,
  38. path: '',
  39. headers: {},
  40. tls: {},
  41. },
  42. },
  43. clients: [
  44. // {
  45. // client: '',
  46. // alias: '',
  47. // multiplexed: false,
  48. // serviceName: '',
  49. // transport: TBufferedTransport,
  50. // protocol: TBinaryProtocol,
  51. // connectType: 'tcp',
  52. // host: '127.0.0.1',
  53. // path: '', only works when connection type is http
  54. // port: '80',
  55. // headers: {
  56. // },
  57. // },
  58. ],
  59. services: [
  60. // {
  61. // service: '',
  62. // processor: '',
  63. // multiplexed: false,
  64. // serviceName: '',
  65. // transport: TBufferedTransport,
  66. // protocol: TBinaryProtocol,
  67. // connectType: 'tcp',
  68. // host: '127.0.0.1',
  69. // path: '', only works when connection type is http
  70. // port: '80',
  71. // headers: {
  72. // },
  73. // },
  74. ],
  75. };

see config/config.default.js for more detail.

Example

Questions & Suggestions

Please open an issue here.

License

MIT