import http from 'http'; function request(path, token) { return new Promise((resolve) => { const start = Date.now(); const req = http.request({ hostname: 'localhost', port: 5000, path, method: 'GET', headers: { 'Authorization': `Bearer ${token}` } }, (res) => { let body = ''; res.on('data', chunk => body += chunk); res.on('end', () => { resolve({ path, status: res.statusCode, time: Date.now() - start, len: body.length }); }); }); req.on('error', (err) => resolve({ path, error: err.message, time: Date.now() - start })); req.setTimeout(5000, () => { req.destroy(); resolve({ path, error: 'TIMEOUT (5s)', time: Date.now() - start }); }); req.end(); }); } async function run() { const loginData = JSON.stringify({ email: 'superadmin@maskan.com', password: 'Admin@123' }); const loginRes = await new Promise(resolve => { const req = http.request({ hostname: 'localhost', port: 5000, path: '/api/v1/auth/login', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(loginData) } }, res => { let body = ''; res.on('data', c => body += c); res.on('end', () => resolve(JSON.parse(body))); }); req.write(loginData); req.end(); }); console.log('Login response:', JSON.stringify(loginRes)); const token = loginRes.data?.token || loginRes.token || loginRes.accessToken || loginRes.data?.accessToken; console.log('Token:', token ? 'Acquired' : 'NOT FOUND'); const endpoints = [ '/api/v1/families', '/api/v1/attributes', '/api/v1/channels', '/api/v1/asset-families', '/api/v1/workflows', '/api/v1/attribute-sets', '/api/v1/brands', '/api/v1/units', '/api/v1/categories' ]; for (const ep of endpoints) { const res = await request(ep, token); console.log(`Endpoint: ${ep.padEnd(25)} Status: ${res.status || res.error} Time: ${res.time}ms`); } } run();