Add max-age value to serve-static
This change may improve caching for static assets. However, most HTTP requests are directed to the Bare server, so the improvement the max-age value makes may be negligible.
This commit is contained in:
parent
1fb7d3c6fc
commit
762d8d7d39
1 changed files with 4 additions and 1 deletions
5
app.js
5
app.js
|
|
@ -14,7 +14,10 @@ const bareServer = createBareServer('/bare/', {
|
||||||
const serve = serveStatic(join(
|
const serve = serveStatic(join(
|
||||||
dirname(fileURLToPath(import.meta.url)),
|
dirname(fileURLToPath(import.meta.url)),
|
||||||
'static/'
|
'static/'
|
||||||
), {fallthrough: false});
|
), {
|
||||||
|
fallthrough: false,
|
||||||
|
maxAge: 5 * 60 * 1000
|
||||||
|
});
|
||||||
|
|
||||||
const server = http.createServer();
|
const server = http.createServer();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue