const http = require('http');

// Test the devices API endpoint
const options = {
  hostname: 'localhost',
  port: 3002,
  path: '/api/school/devices-test',
  method: 'GET',
  headers: {
    'Content-Type': 'application/json'
  }
};

const req = http.request(options, (res) => {
  console.log(`Status Code: ${res.statusCode}`);
  console.log(`Headers:`, res.headers);
  
  let data = '';
  res.on('data', (chunk) => {
    data += chunk;
  });
  
  res.on('end', () => {
    console.log('Response Body:', data);
    try {
      const jsonData = JSON.parse(data);
      console.log('Parsed JSON:', jsonData);
    } catch (error) {
      console.log('Response is not valid JSON');
    }
  });
});

req.on('error', (error) => {
  console.error('Request Error:', error.message);
});

req.end();