mirror of
https://github.com/spliit-app/spliit.git
synced 2026-02-21 06:56:12 +01:00
Add health check endpoint and resolve locale detection bug (#387)
* Add health check API endpoint with database connectivity * Update locale handling to fallback to default language on invalid input * Add health check endpoints for application readiness and liveness - Introduced `/api/health/readiness` endpoint to check if the application can serve requests, including database connectivity. - Introduced `/api/health/liveness` endpoint to verify if the application is running independently of external dependencies. - Updated the health check logic to streamline database connectivity checks and response handling. * Refactor health check logic --------- Co-authored-by: Julen Dixneuf <julen.d@padoa-group.com>
This commit is contained in:
7
src/app/api/health/liveness/route.ts
Normal file
7
src/app/api/health/liveness/route.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { checkLiveness } from '@/lib/health'
|
||||
|
||||
// Liveness: Is the app itself healthy? (no external dependencies)
|
||||
// If this fails, Kubernetes should restart the pod
|
||||
export async function GET() {
|
||||
return checkLiveness()
|
||||
}
|
||||
7
src/app/api/health/readiness/route.ts
Normal file
7
src/app/api/health/readiness/route.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { checkReadiness } from '@/lib/health'
|
||||
|
||||
// Readiness: Can the app serve requests? (includes all external dependencies)
|
||||
// If this fails, Kubernetes should stop sending traffic but not restart
|
||||
export async function GET() {
|
||||
return checkReadiness()
|
||||
}
|
||||
7
src/app/api/health/route.ts
Normal file
7
src/app/api/health/route.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { checkReadiness } from '@/lib/health'
|
||||
|
||||
// Default health check - same as readiness (includes database check)
|
||||
// This is readiness-focused for monitoring tools like uptime-kuma
|
||||
export async function GET() {
|
||||
return checkReadiness()
|
||||
}
|
||||
Reference in New Issue
Block a user