Skip to content

Instantly share code, notes, and snippets.

@isao
Last active December 11, 2015 16:19
Show Gist options
  • Save isao/4627066 to your computer and use it in GitHub Desktop.
Save isao/4627066 to your computer and use it in GitHub Desktop.
my sky pie psuedocode
var express = require('express'),
app = express(),
// starts with a set of paths, and optional env/fw/app rules to merge
config = require('./config/start')(process.argv, process.env);
locator = require('locator'),
foo = locator.bar(/* ?? */);
function callback(locations) {
locator.middleware().forEach(function (fn) {
app.use.apply(app, fn());
});
locator.staticRoutes().forEach(function (fn) {
app.use.apply(app, fn());
});
locator.cachedRoutes().forEach(function (fn) {
app.use.apply(app, fn());
});
locator.pages().forEach(function (fn) {
app.use.apply(app, fn(foo));
});
locator.partials().forEach(function (fn) {
app.use.apply(app, fn());
});
locator.api().forEach(function (fn) {
app.use.apply(app, fn());
});
app.listen(locator.getConfig('port'));
}
locator.start(config, callback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment