Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example node-thrift server
var thrift = require('thrift');
var JobExchange = require('./gen-nodejs/JobExchange'),
ttypes = require('./gen-nodejs/scheduler_types');
var server = thrift.createServer(JobExchange, {
insert_job: function(job, callback) {
// job is an instance of ttypes.Job
process.nextTick(function() {
callback(1);
});
},
get_job: function(jid, callback) {
callback(new ttypes.Job());
},
get_all: function(callback) {
callback([new ttypes.Job()]);
}
});
server.listen(9160);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.