Skip to content

Commit c6315e4

Browse files
committed
Run smoke tests for connectivity purposes
1 parent f09e0f3 commit c6315e4

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

webapp/app/api/monitoring/route.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { NextResponse } from 'next/server';
2+
3+
export async function GET() {
4+
try {
5+
const apiBaseUrl = process.env.SHORTENED_BASE_URL;
6+
if (!apiBaseUrl) {
7+
throw new Error('API_BASE_URL not configured');
8+
}
9+
const pingResponse = await fetch(`${apiBaseUrl}/ping`);
10+
const data = await pingResponse.json();
11+
if (data.status === 'ok') {
12+
return NextResponse.json({ ready: true }, { status: 200 });
13+
}
14+
} catch (error: any) {
15+
return NextResponse.json({ error: error.message }, { status: 400 });
16+
}
17+
}

webapp/app/api/url-shortener/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export async function POST(request: NextRequest) {
1212
const shortenedBaseUrl = process.env.SHORTENED_BASE_URL;
1313

1414
if (!shortenedBaseUrl) {
15-
throw new Error('SHORTENED_BASE_URL not configured');
15+
throw new Error('API_BASE_URL not configured');
1616
}
1717
const shortenedUrl = await createShortenUrl(url, shortenedBaseUrl);
1818
return NextResponse.json({ shortenedUrl }, { status: 200 });

0 commit comments

Comments
 (0)