Created
April 16, 2016 03:23
-
-
Save jgensler8/bfda5349603c60062584c9f3e59276a3 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_storage = require('microlib-redis-storage'); | |
module.exports = { | |
statichost: microlib.builder | |
.injectPersistentStorage(redis_storage, os.environ.REDIS_URL) | |
.setScheduleStrategy(microlib.COLOCATE_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 = { | |
templateengine: microlib.builder | |
.setFunction(function(services, args) { | |
return args[0].replace(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 listener = require('microlib-listener'); | |
var static_host = require('microlib-static-host'); | |
var template_engine = require('microlib-template-engine'); | |
var db_read = require('microlib-db-read'); | |
var db_inc = require('microlib-db-inc'); | |
// first, lets build our page enginer | |
var index_server = microlib.builder | |
.injectService(static_host) | |
.injectService(template_enginer) | |
.injectService(db_read) | |
.injectService(db_inc) | |
.setFunction(function(services, args){ | |
var page = services[0]("index.html"); | |
var templated_page = services[1](page, "visits", services[3]("visits")) | |
}) | |
services[4](1); | |
return templated_page; | |
}) | |
.build(); | |
microlib | |
.pollOn(80) | |
.injectService(index_server) | |
.setFunction(function(services, args) { | |
return services[0](); | |
}) | |
.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment