Initial commit

This commit is contained in:
Jennie Robinson Faber 2025-11-11 19:12:21 +00:00
commit 92e96b9107
85 changed files with 24969 additions and 0 deletions

View file

@ -0,0 +1,32 @@
import mongoose from 'mongoose'
export default defineEventHandler(async (event) => {
const checks = {
status: 'ok',
timestamp: new Date().toISOString(),
uptime: process.uptime(),
mongodb: 'disconnected',
memory: process.memoryUsage(),
}
// Check MongoDB connection
try {
if (mongoose.connection.readyState === 1) {
checks.mongodb = 'connected'
} else {
checks.mongodb = 'disconnected'
}
} catch (error) {
checks.mongodb = 'error'
}
// Return 503 if any critical service is down
const isHealthy = checks.mongodb === 'connected'
if (!isHealthy) {
setResponseStatus(event, 503)
checks.status = 'unhealthy'
}
return checks
})