Fixes #491 adds support for a configurable cache-control max-age setting for serving static assets, with a default of 1d on production and 0 elsewhere (#492)

This commit is contained in:
Francis Li 2017-12-08 12:01:39 -08:00 committed by Cassie Tarakajian
parent 82ca755362
commit aadd533061

View file

@ -57,7 +57,9 @@ app.options('*', corsMiddleware);
// Body parser, cookie parser, sessions, serve public assets // Body parser, cookie parser, sessions, serve public assets
app.use(Express.static(path.resolve(__dirname, '../static'))); app.use(Express.static(path.resolve(__dirname, '../static'), {
maxAge: process.env.STATIC_MAX_AGE || (process.env.NODE_ENV === 'production' ? '1d' : '0')
}));
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true })); app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
app.use(bodyParser.json({ limit: '50mb' })); app.use(bodyParser.json({ limit: '50mb' }));
app.use(cookieParser()); app.use(cookieParser());