kv-music/qobuz-api/get-countries/route.ts
2026-02-11 06:51:52 +00:00

29 lines
838 B
TypeScript

import { tokenCountriesMap, TokenCountry } from '@/config/token-countries';
import { NextResponse } from 'next/server';
export async function GET() {
if (tokenCountriesMap.length === 0) {
return new NextResponse(
JSON.stringify({
success: false,
error: 'No countries list found',
})
);
}
try {
const countryCodes: string[] = tokenCountriesMap.map((country: TokenCountry) => country.code);
return new NextResponse(
JSON.stringify({
success: true,
data: countryCodes,
})
);
} catch {
return new NextResponse(
JSON.stringify({
success: false,
error: 'Error parsing the countries list',
})
);
}
}