Files
BelgianBitcoinEmbassy/frontend/app/.well-known/nostr.json/route.ts
Michilis 8cdf0231ce fix(frontend): resolve API base URL at request time for production
Use same-origin /api in the browser so builds are not stuck with baked-in
localhost. Server-side fetches use INTERNAL_API_URL, NEXT_PUBLIC_API_URL, or
loopback. Centralize logic in lib/api-base.ts.

Made-with: Cursor
2026-04-01 19:52:54 +00:00

19 lines
545 B
TypeScript

import { NextRequest, NextResponse } from 'next/server';
import { apiUrl } from '@/lib/api-base';
export async function GET(req: NextRequest) {
const name = req.nextUrl.searchParams.get('name');
const upstream = new URL(apiUrl('/nip05'));
if (name) upstream.searchParams.set('name', name);
const res = await fetch(upstream.toString(), { cache: 'no-store' });
const data = await res.json();
return NextResponse.json(data, {
headers: {
'Access-Control-Allow-Origin': '*',
'Cache-Control': 'no-store',
},
});
}