Skip to content

Instantly share code, notes, and snippets.

@jgensler8
Created April 17, 2016 03:47
Show Gist options
  • Save jgensler8/d3d6dfbb7f5503d53237f669b1064579 to your computer and use it in GitHub Desktop.
Save jgensler8/d3d6dfbb7f5503d53237f669b1064579 to your computer and use it in GitHub Desktop.
var jayson = require('jayson');
// create an array of injected services
var services = [
function(args) {
return jayson.client.http({
host: process.env.MICROLIB_SERVICE_HOST,
port: process.env.MICROLIB_SERVICE_PORT
}).request("addtwo", args, function(err, response) {
return response.result;
});
},
];
// create the current service
var server = jayson.server({
addthree : function(args, callback) {
(function (services, args, callback) {
callback(null, serivces[0](args[0], args[1]) + args[3] );
})(services, args, callback);
}
});
server.http().listen( process.env.MICROLIB_SERVICE_PORT );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment