thriftnode-util
v1.0.2
Published
The project offers the following functionalities: a) Generation of Javascript files from the Thrift IDL (Interface Description Language) files b) Provides the client instance to communicate with the Thrift downstream servers.
Downloads
3
Readme
Thrift IDL for NodeJS
The project offers the following functionalities: a) Generation of Javascript files from the Thrift IDL (Interface Description Language) files b) Provides the client instance to communicate with the Thrift downstream servers.
Reference
Clone
$ git clone ssh://[email protected]:2222/kiran-uday/thrift2nodejs-util.git
Install the package from npm
$ npm install thriftnode-util --save
Build thrift Files stored in your project
$ thrift2node <PATH-TO-THRIFT-IDL_DIR> # PATH-TO-THRIFT-IDL_DIR - The Thrift IDL (.thrift) files directory path
Create Thrift Client Instance
const thriftClient = require('thriftnode-util');
router.get('/:id', function(req, res) {
thriftClient.getThriftClient('com.content', 'ContentService', {
hostName: DOWNSTREAM_HOST_NAME,
port: DOWNSTREAM_POST,
path: '/',
}).getPost(req.params.id).then(post => { // getPost is the API exposed through the Thrift IDL
// Handle Success
}, (error) => {
// Handle error
});
});