Thrift client library for NodeJS written in TypeScript.
$ npm install$ npm start
This will start a web server on localhost:8080. The sample app has a UI you can visit from a web browser.
The sample app can switch between using a Request client or an Axios client by commenting these lines in example/client.ts
// Create thrift client// Using Request// Using Axios
Functions are available to wrap either Request or Axios instances for making requests to a Thrift service.
$ npm install --save thrift$ npm install --save @types/thrift$ npm install --save @creditkarma/thrift-client$ npm install --save axios
Given the following service definition we will build a sample client.
Would be used in a TypeScript service client as such:
// 'transport', 'protocol' and 'path' are optional and will default to these values// Create thrift client// This receives a query like ""app.get'/add',app.listenserverConfig.port,
The possible transport types are:
The possible protocol types are:
While Thrift Client includes support for Axios and Request using another Http client library should be easy. You need to extend the abstract HttpConnection class and implement the abstract write method.
As an example look at the AxiosConnection:
For more information about contributing new features and bug fixes, see our Contribution Guidelines. External contributors must sign Contributor License Agreement (CLA)
This project is licensed under Apache License Version 2.0