cache static files for webserver

This commit is contained in:
Anthony 2021-06-01 15:45:04 +02:00 committed by Jeremy Kauffman
parent 78d4efd8f3
commit f0cd159235

View file

@ -27,6 +27,12 @@ app.use(logger());
app.use(cacheControlMiddleware); app.use(cacheControlMiddleware);
app.use(redirectMiddleware); app.use(redirectMiddleware);
app.use(iframeDestroyerMiddleware); app.use(iframeDestroyerMiddleware);
// Check if the request url matches any assets inside of /dist
app.use(serve(DIST_ROOT, {
maxage: 3600000, // set a cache time of one hour, helpful for mobile dev
}));
app.use(serve(DIST_ROOT)); // Check if the request url matches any assets inside of /dist app.use(serve(DIST_ROOT)); // Check if the request url matches any assets inside of /dist
app.use(router.routes()); app.use(router.routes());