comprehensive monitoring and logging system
This commit is contained in:
17
pages/api/health.ts
Normal file
17
pages/api/health.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { NextApiRequest, NextApiResponse } from "next"
|
||||
import { getHealthStatus } from "../../lib/monitoring"
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (req.method !== "GET") return res.status(405).json({ error: "Method not allowed" })
|
||||
|
||||
try {
|
||||
const health = getHealthStatus()
|
||||
res.status(200).json(health)
|
||||
} catch (error) {
|
||||
res.status(500).json({
|
||||
status: 'unhealthy',
|
||||
error: 'Health check failed',
|
||||
timestamp: new Date().toISOString()
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user