Hot Topics: - Dynamic topics from /api/hot-topics loaded in Blog Engine tab - 7 data sources (prices, competitors, hype cycle, news, conferences, research, evergreen) - Urgency badges: BREAKING (red), HOT (orange), TRENDING (yellow), EMERGING (green) Pipeline Lock: - Only 1 generation at a time, 'Pipeline Busy' toast on double-click - Progress bar with step names (external hot-topics.js, no inline hacks) Blog Delete: - DELETE /api/blog/:id endpoint - Delete button (✕) on each blog in list - 'Delete All Templates' button to clean up test drafts Fix: dashboard JS extracted to external hot-topics.js to avoid sed quote hell
33 lines
798 B
TypeScript
33 lines
798 B
TypeScript
import { Router, Request, Response } from "express";
|
|
import { getDbStats } from "../db/queries";
|
|
import { pool } from "../db/client";
|
|
|
|
export const healthRouter = Router();
|
|
|
|
// GET /api/health — Health check with DB stats
|
|
healthRouter.get("/", async (_req: Request, res: Response) => {
|
|
try {
|
|
const start = Date.now();
|
|
const stats = await getDbStats();
|
|
const latencyMs = Date.now() - start;
|
|
|
|
res.json({
|
|
success: true,
|
|
status: "healthy",
|
|
version: "0.2.6",
|
|
uptime: process.uptime(),
|
|
database: {
|
|
connected: true,
|
|
latency_ms: latencyMs,
|
|
stats,
|
|
},
|
|
});
|
|
} catch (err) {
|
|
res.status(503).json({
|
|
success: false,
|
|
status: "unhealthy",
|
|
database: { connected: false, error: String(err) },
|
|
});
|
|
}
|
|
});
|