feat: add PWA and offline mode support with local caching and action safeguards
This commit is contained in:
parent
039b5ac483
commit
128a5f7553
15 changed files with 589 additions and 0 deletions
|
|
@ -27,6 +27,20 @@ app.set('views', viewsPath);
|
|||
app.use(express.urlencoded({ extended: true }));
|
||||
app.use(express.json());
|
||||
app.use(cookieParser());
|
||||
|
||||
// Custom Service Worker route with proper scope and no-cache headers
|
||||
app.get('/sw.js', (req: Request, res: Response) => {
|
||||
res.setHeader('Service-Worker-Allowed', '/');
|
||||
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
|
||||
res.setHeader('Content-Type', 'application/javascript; charset=utf-8');
|
||||
res.sendFile(path.resolve(publicPath, 'sw.js'));
|
||||
});
|
||||
|
||||
// Lightweight network / connectivity health probe
|
||||
app.get('/api/health', (req: Request, res: Response) => {
|
||||
res.json({ status: 'ok', timestamp: Date.now() });
|
||||
});
|
||||
|
||||
app.use(express.static(publicPath));
|
||||
|
||||
app.use(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue