Last active
April 16, 2016 03:19
-
-
Save jgensler8/ea4f4e4deaafd9f945d82c338f1ff3df 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 microlib = require('microlib'); | |
var redis_service = require('redis-service'); | |
module.exports = { | |
db: microlib.builder | |
.injectPersistentStorage(redis_service, os.environ.REDIS_URL) | |
.setScheduleStrategy(microlib.GRAVITY_STRATEGY) | |
.setFunction(function(services, args){ | |
return services[0](args[0]); | |
}) | |
.build() | |
} |
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 microlib = require('microlib'); | |
module.exports = { | |
addTwoMicroservice: microlib.builder | |
.setScheduleStrategy(microlib.COLOCATE_STRATEGY) | |
.setFunction(function(services, args) { | |
return args[1] + args[0]; | |
}) | |
.build() | |
// spinUpON is provided by the builder | |
addThreeMicroservice: microlib.builder | |
// scoping issues? one service per file? | |
.injectService(addTwoMicroservice) | |
.setScheduleStrategy(microlib.COLOCATE_STRATEGY) | |
.setFunction(function(services, args) { | |
return services[0].run(args[0],args[1]) + args[2]; | |
}) | |
.build() | |
} |
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 microlib = require('microlib'); | |
var service = require('service'); | |
var cache = require('cache'); | |
microlib | |
.builder | |
.injectService(service.addTwoMS, os.environ.GIVE_ME_IT_SERVICE_URL) | |
.injectService(service.addThreeMS, os.environ.GIVE_ME_IT_SERVICE_URL) | |
.injectService(cache.db, os.environ.GIVE_ME_IT_SERVICE_URL) | |
.setfunction(function(serivces, args) { | |
if(services[0](3,3) === services[1](1,2,3)) | |
return services[2]("success"); | |
else | |
return ":("; | |
}) | |
.build() | |
.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment