feat : add docker

This commit is contained in:
Yusron alamsyah
2026-02-27 14:17:28 +07:00
parent a1efe0a73b
commit 8d9c2585e4
10 changed files with 459 additions and 25 deletions
+33
View File
@@ -0,0 +1,33 @@
// server/api/health.get.ts
// Health check endpoint for Docker and monitoring
export default defineEventHandler(async (event) => {
try {
// Basic health check
const health = {
status: 'healthy',
timestamp: new Date().toISOString(),
uptime: process.uptime(),
environment: process.env.NODE_ENV || 'development',
memory: {
used: Math.round(process.memoryUsage().heapUsed / 1024 / 1024),
total: Math.round(process.memoryUsage().heapTotal / 1024 / 1024),
unit: 'MB'
}
};
return {
success: true,
...health
};
} catch (error: any) {
// If health check fails, return 500
setResponseStatus(event, 500);
return {
success: false,
status: 'unhealthy',
error: error.message,
timestamp: new Date().toISOString()
};
}
});