fix Cache-Control in sapper

This commit is contained in:
Nolan Lawson 2018-03-20 20:46:37 -07:00
parent 0c9992c0e1
commit 99ff58968b
3 changed files with 7 additions and 3 deletions

2
package-lock.json generated
View File

@ -8102,7 +8102,7 @@
} }
}, },
"sapper": { "sapper": {
"version": "github:nolanlawson/sapper#ec86bbb81d6b7346d3332b3d31fd507a01010f2f", "version": "github:nolanlawson/sapper#701bc3455a9387d76f8047e7152c8295c9516788",
"requires": { "requires": {
"chalk": "2.3.2", "chalk": "2.3.2",
"chokidar": "1.7.0", "chokidar": "1.7.0",

View File

@ -53,7 +53,7 @@
"pify": "^3.0.0", "pify": "^3.0.0",
"quick-lru": "^1.1.0", "quick-lru": "^1.1.0",
"requestidlecallback": "^0.3.0", "requestidlecallback": "^0.3.0",
"sapper": "nolanlawson/sapper#monkey-patches", "sapper": "github:nolanlawson/sapper#monkey-patches",
"serve-static": "^1.13.1", "serve-static": "^1.13.1",
"standard": "^10.0.3", "standard": "^10.0.3",
"stringz": "^0.4.0", "stringz": "^0.4.0",

View File

@ -14,7 +14,11 @@ global.fetch = (url, opts) => {
app.use(compression({ threshold: 0 })) app.use(compression({ threshold: 0 }))
app.use(serveStatic('assets')) app.use(serveStatic('assets', {
setHeaders: (res) => {
res.setHeader('Cache-Control', 'public,max-age=14400')
}
}))
app.use(sapper()) app.use(sapper())