Created
June 15, 2012 18:43
-
-
Save ovaillancourt/2938107 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 cfg = require('kr-common').config; | |
var express = require('express'); | |
var app = express.createServer(); | |
var fs = require('fs'); | |
//Html bundler | |
app.use(require('./server/htmlBundler')({ | |
dirs : [ __dirname + '/static/templates', | |
{path: __dirname + '/static/templates/controls', namespace: 'controls'} | |
], | |
// debug: true | |
})); | |
//Browserify client app | |
app.use(require('browserify')({ | |
mount: '/bespoke.js', | |
entry: __dirname + '/client/main.js', | |
watch: true, | |
cache: __dirname + '/.browserify.bespoke.json', | |
})); | |
//Browserify dependencies js | |
app.use(require('browserify')({ | |
mount: '/dependencies.js', | |
entry: require('./includes').entry, | |
watch: true, | |
cache: __dirname + '/.browserify.dependencies.json', | |
})); | |
app.use('/static',express.static(__dirname + '/static')); | |
app.use(app.router); | |
//Serve index file, catch all route so put it at the end. | |
app.get('*',function(req,res,next){ | |
return res.sendfile(__dirname + '/static/index.html'); | |
}); | |
//Start the static file server and we're done! | |
app.listen(cfg.port_stylist); | |
console.log('[stylist] listening on port ' + cfg.port_stylist); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment