Add update-available banner via periodic health version check
Backend /health now returns a build version; frontend polls it every 2 minutes (and on tab focus) and shows a reload banner when it changes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
56da4c72b2
commit
04f8c9f45c
4 changed files with 98 additions and 4 deletions
|
|
@ -5,6 +5,7 @@ import { initDb } from './db.js'
|
|||
import { noticeRoutes } from './routes/notices.js'
|
||||
|
||||
const app = Fastify({ logger: true, trustProxy: true })
|
||||
const startedAt = Date.now()
|
||||
|
||||
await app.register(cookie)
|
||||
await app.register(cors, {
|
||||
|
|
@ -12,7 +13,7 @@ await app.register(cors, {
|
|||
credentials: true,
|
||||
})
|
||||
|
||||
app.get('/health', async () => ({ status: 'healthy' }))
|
||||
app.get('/health', async () => ({ status: 'healthy', version: process.env.BUILD_VERSION || String(startedAt) }))
|
||||
|
||||
await app.register(noticeRoutes)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue