const fs = require('fs');

async function test() {
  try {
    // Read .env.local to get API Key
    const envFile = fs.readFileSync('.env.local', 'utf8');
    const apiKeyMatch = envFile.match(/RUMAHOTP_API_KEY=(.*)/);
    const apiKey = apiKeyMatch ? apiKeyMatch[1].trim() : '';
    
    if (!apiKey || apiKey === 'your-rumahotp-api-key') {
      console.log('NO VALID API KEY FOUND IN .env.local');
      return;
    }

    const res = await fetch('https://api.rumahotp.io/v2/countries?service_id=13', {
      headers: {
        'x-apikey': apiKey,
        'accept': 'application/json'
      }
    });
    
    const data = await res.json();
    console.log(JSON.stringify(data, null, 2).substring(0, 1500));
  } catch (err) {
    console.error(err);
  }
}
test();
