Update Dockerfile and docker-compose.yml to change application port to 6060; add health check endpoint. Add cookie dependency to package.json and create health check API endpoint.
This commit is contained in:
29
server/api/health.get.ts
Normal file
29
server/api/health.get.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
try {
|
||||
// Basic health check - can be expanded to check database, storage, etc.
|
||||
const health = {
|
||||
status: 'healthy',
|
||||
timestamp: new Date().toISOString(),
|
||||
uptime: process.uptime(),
|
||||
checks: {
|
||||
server: 'healthy',
|
||||
// Add more checks as needed
|
||||
// database: await checkDatabase(),
|
||||
// storage: await checkStorage(),
|
||||
// auth: await checkAuth(),
|
||||
},
|
||||
};
|
||||
|
||||
return health;
|
||||
} catch (error) {
|
||||
throw createError({
|
||||
statusCode: 503,
|
||||
statusMessage: 'Service Unavailable',
|
||||
data: {
|
||||
status: 'unhealthy',
|
||||
timestamp: new Date().toISOString(),
|
||||
error: error instanceof Error ? error.message : 'Unknown error',
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user