cache-control config

This commit is contained in:
Сергей Куликов
2016-04-18 14:08:28 +03:00
committed by Lloyd Brookes
parent aa11620b8e
commit 1c57d29b3f
3 changed files with 10 additions and 1 deletions

View File

@ -38,6 +38,7 @@ function localWebServer (options) {
options = Object.assign({
static: {},
serveIndex: {},
cacheControl: {},
spa: null,
log: {},
compress: false,
@ -116,6 +117,13 @@ function localWebServer (options) {
middlewareStack.push(etag())
}
/* cache-control headers */
if (options.cacheControl) {
const cacheControl = require('koa-cache-control')
debug('Cache control', JSON.stringify(options.cacheControl))
app.use(cacheControl(options.cacheControl))
}
/* mime-type overrides */
if (options.mime) {
debug('mime override', JSON.stringify(options.mime))