bill
unread,Apr 18, 2012, 4:40:58 PM4/18/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Express
I'm trying to figure out how to use the staticCache(), static(), and
compress() middlewares with Express 3.0 (not specific to 3.0, never
had it working in 2.5 either). This is what my app configuration
looks like:
app.configure(function() {
app.use(express.favicon(__dirname + '/../public/favicon.ico',
{maxAge: 8640000000}));
app.use(express.bodyParser());
app.use(express.cookieParser('foo'));
app.set('views', __dirname + '/views');
app.engine('.html', mustache({cache: true}).render);
app.use(express.session(
{ store: sessionStore,
secret: 'foo'
})
);
app.use(express.staticCache());
app.use(express.static(__dirname + '/../public', {maxAge:
8640000000}));
app.use(express.compress());
});
When I look the responses, the staticCache() always misses and my .css
and .js files are not being sent compressed. I figure the ordering is
wrong or I'm missing a setting but I can't figure it out. My routes
are defined after the app.configure() block.
Without the express.compress() line, the staticCache() starts
reporting cache hits again.
Does somebody have a sample app that uses staticCache, static, and
compress and has everything working?