![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.quebec/private_html/scripts/ |
const fetch = require('node-fetch');
async function testAPIEndpoint() {
console.log('š Testing API Endpoint Accessibility...\n');
try {
// Test the exact API endpoint the frontend calls
const apiUrl = 'http://localhost:3000/api/admin/users?role=LAWYER,ADMIN';
console.log(`1. Testing API endpoint: ${apiUrl}`);
const response = await fetch(apiUrl, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
console.log(` Response status: ${response.status} ${response.statusText}`);
if (response.ok) {
const data = await response.json();
console.log(' ā
API call successful!');
console.log(` Response data:`, {
hasUsers: !!data.users,
usersIsArray: Array.isArray(data.users),
usersLength: data.users?.length || 0
});
if (data.users && data.users.length > 0) {
console.log(' Sample lawyers:');
data.users.slice(0, 3).forEach((lawyer, index) => {
console.log(` ${index + 1}. ${lawyer.name} (${lawyer.role}) - ID: ${lawyer.id}`);
});
}
} else {
console.log(' ā API call failed');
const errorText = await response.text();
console.log(' Error response:', errorText);
}
} catch (error) {
console.error('ā Network error:', error.message);
console.log('\nš” This might indicate:');
console.log(' 1. Server is not running');
console.log(' 2. Wrong port number');
console.log(' 3. Network connectivity issues');
console.log(' 4. CORS issues');
}
}
// Run the test
testAPIEndpoint();