thtp

0.0.1 • Public • Published

thtp-js

Client

The THTP client requires Thrift definitions which have been augmented to expose the args and result structs for each RPC. This can be achieved by adding a step to the Thrift compilation process: once thrift has been run and js:node definitions have been created, run

# Set to wherever your definitions are outputted 
output_dir=target/gen-nodejs
# Modify files (saving originals as *.bak) 
find $output_dir -iname '*Service.js' -type f -exec sed -i.bak -E 's/^var ([A-Za-z0-9_]*(_args|_result)) =/var \1 = exports.\1 =/' {} \;

For each rpc Service.do_action, this will export Service_do_thing_args and Service_do_thing_result, the structs that Thrift-RPC uses under the hood to manage request/response bodies.

Package Sidebar

Install

npm i thtp

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

11 kB

Total Files

8

Last publish

Collaborators

  • anujdas