Fix mobile view Bugs and add versions to static files for cache breaking
This commit is contained in:
@@ -18,7 +18,19 @@ app.use(express.json({
|
||||
}));
|
||||
app.use(express.urlencoded({ extended: true, limit: '2mb' }));
|
||||
app.use('/api', createApiRouter(db));
|
||||
app.use(express.static(path.join(__dirname, 'public'), { extensions: ['html'] }));
|
||||
app.use(express.static(path.join(__dirname, 'public'), {
|
||||
extensions: ['html'],
|
||||
etag: true,
|
||||
lastModified: true,
|
||||
maxAge: 0,
|
||||
setHeaders(res, filePath) {
|
||||
if (filePath.endsWith('.html')) {
|
||||
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
|
||||
return;
|
||||
}
|
||||
res.setHeader('Cache-Control', 'public, max-age=0, must-revalidate');
|
||||
}
|
||||
}));
|
||||
app.use(notFoundHandler);
|
||||
app.use(errorHandler);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user