Created
April 17, 2016 03:47
-
-
Save jgensler8/d3d6dfbb7f5503d53237f669b1064579 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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