sdfsd
This commit is contained in:
@@ -59,7 +59,25 @@ const publicDir = config.publicDir.startsWith('/')
|
||||
|
||||
console.log(`Serving frontend from: ${publicDir}`);
|
||||
|
||||
app.use(express.static(publicDir));
|
||||
// Avoid stale frontend JS while we are actively developing the MVP.
|
||||
app.use((req, res, next) => {
|
||||
if (
|
||||
req.path.endsWith('.js') ||
|
||||
req.path.endsWith('.css') ||
|
||||
req.path.endsWith('.html')
|
||||
) {
|
||||
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
|
||||
res.setHeader('Pragma', 'no-cache');
|
||||
res.setHeader('Expires', '0');
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(express.static(publicDir, {
|
||||
etag: false,
|
||||
lastModified: false,
|
||||
}));
|
||||
|
||||
app.get('*', (_req, res) => {
|
||||
res.sendFile(resolve(publicDir, 'index.html'));
|
||||
|
||||
Reference in New Issue
Block a user