update for express 4.x

This commit is contained in:
Tom Hunkapiller 2015-04-07 07:55:05 -05:00
parent 7b86eb09bc
commit d0b39c01fb
8 changed files with 25 additions and 24 deletions

View file

@ -9,11 +9,11 @@ exports.expressCreateServer = function (hook_name, args, cb) {
// Cache both minified and static.
var assetCache = new CachingMiddleware;
args.app.all('/(javascripts|static)/*', assetCache.handle);
args.app.all(/\/(javascripts|static)\/(.*)/, assetCache.handle);
// Minify will serve static files compressed (minify enabled). It also has
// file-specific hacks for ace/require-kernel/etc.
args.app.all('/static/:filename(*)', minify.minify);
args.app.all('/static/:filename', minify.minify);
// Setup middleware that will package JavaScript files served by minify for
// CommonJS loader on the client-side.
@ -30,7 +30,8 @@ exports.expressCreateServer = function (hook_name, args, cb) {
Yajsml.associators.associationsForSimpleMapping(minify.tar);
var associator = new StaticAssociator(associations);
jsServer.setAssociator(associator);
args.app.use(jsServer);
args.app.use(jsServer.handle.bind(jsServer));
// serve plugin definitions
// not very static, but served here so that client can do require("pluginfw/static/js/plugin-definitions.js");