← back to Stars of Design
sod GET /api/health — mirrors asim. SELECT 1 liveness via statsPool, no-store, JSON ok+ts.
fd9f828f2466a0b0c77469052d73dfb862e4e7fb · 2026-05-13 08:42:46 -0700 · Steve Abrams
Files touched
Diff
commit fd9f828f2466a0b0c77469052d73dfb862e4e7fb
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed May 13 08:42:46 2026 -0700
sod GET /api/health — mirrors asim. SELECT 1 liveness via statsPool, no-store, JSON ok+ts.
---
routes/public.js | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/routes/public.js b/routes/public.js
index 255e4b6..e0077d1 100644
--- a/routes/public.js
+++ b/routes/public.js
@@ -40,6 +40,19 @@ router.get('/healthz', (req, res) => {
res.json({ ok: true, ts: Date.now() });
});
+// /api/health — slightly heavier liveness + count snapshot. Mirrors asim
+// /api/health pattern; uses the same shared statsPool. 30s cache stays
+// fresh enough for monitoring tools without hammering pg.
+router.get('/api/health', async (_req, res) => {
+ try {
+ res.setHeader('Cache-Control', 'no-store');
+ const r = await statsPool.query('SELECT 1 AS ok');
+ res.json({ ok: r.rows[0].ok === 1, ts: Date.now() });
+ } catch (e) {
+ res.status(500).json({ ok: false, error: e.message });
+ }
+});
+
router.get('/', (req, res, next) => {
try {
const all = data.load();
← 660a173 sod smoke --json suppresses header
·
back to Stars of Design
·
sod /api discovery — list /api/health + smoke +2 /api/health c0ba760 →