kopia lustrzana https://github.com/badgen/badgen.net
Add cache header to statics
rodzic
3b8ee1084a
commit
36d6496912
7
index.ts
7
index.ts
|
@ -27,7 +27,12 @@ const { PUB_DIR = '.' } = process.env
|
|||
const server = http.createServer(async (req, res) => {
|
||||
// handle statics
|
||||
if (isStatic(req.url)) {
|
||||
return serveHandler(req, res, { public: path.resolve(__dirname, PUB_DIR) })
|
||||
return serveHandler(req, res, {
|
||||
public: path.resolve(__dirname, PUB_DIR),
|
||||
headers: [
|
||||
{ "source": "**/*", "headers": "public, max-age: 86400, s-maxage: 86400" }
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
// handle `/docs/:name`
|
||||
|
|
Ładowanie…
Reference in New Issue