When you click Generate: - Dark overlay with orange progress bar shows pipeline status - Live step counter: 'Step 3/10: Outline Generation — decision-driven structure' - Percentage updates every 15 seconds via API polling - When done: shows word count + QA score, auto-opens the article - No more silent template dump — user sees the entire pipeline working
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.4",
|
|
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) },
|
|
});
|
|
}
|
|
});
|