Skip to content

Commit 136c3b4

Browse files
committed
update url for monitoring
1 parent 95deaaf commit 136c3b4

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

.github/workflows/cd.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@ jobs:
6767
- name: Smoke test API
6868
run: |
6969
sleep 15
70-
curl -sf http://localhost:3001/monitoring/readiness || exit 1
70+
curl -f -s -o /dev/null -w "%{http_code}" http://localhost:3001/monitoring/readiness | grep -q "^200$" || {
71+
echo "API not healthy (didn't return 200)"
72+
exit 1
73+
}
7174
7275
- name: Smoke test Webapp
7376
run: |
7477
sleep 15
75-
curl -sf http://localhost:3000/api/monitoring || exit 1
78+
curl -f -s -o /dev/null -w "%{http_code}" http://localhost:3000/api/monitoring/readiness | grep -q "^200$" || {
79+
echo "Webapp not healthy (didn't return 200)"
80+
exit 1
81+
}

api/src/infrastructure/monitoring/health.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ export class HealthController {
3030

3131
@Get('/ping')
3232
async ping(): Promise<{ status: string }> {
33-
return { status: 'ok' };
33+
return { status: 'OK' };
3434
}
3535
}

webapp/app/api/monitoring/route.ts renamed to webapp/app/api/monitoring/readiness/route.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@ export async function GET() {
66
if (!apiBaseUrl) {
77
throw new Error('API_BASE_URL not configured');
88
}
9-
const pingResponse = await fetch(`${apiBaseUrl}/ping`);
9+
const pingResponse = await fetch(`${apiBaseUrl}/monitoring/ping`);
1010
const data = await pingResponse.json();
11-
if (data.status === 'ok') {
12-
return NextResponse.json({ ready: true }, { status: 200 });
11+
if (data.status === 'OK') {
12+
return NextResponse.json({ status: 'OK' }, { status: 200 });
13+
} else {
14+
console.log(data);
15+
return NextResponse.json(
16+
{ error: data.message },
17+
{ status: data.status }
18+
);
1319
}
1420
} catch (error: any) {
1521
return NextResponse.json({ error: error.message }, { status: 400 });

0 commit comments

Comments
 (0)