1.0.2 • Published 5 years ago
thriftnode-util v1.0.2
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://git@gitlab.corp.olacabs.com: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
});
});