-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-api-simple.js
More file actions
43 lines (34 loc) · 1.03 KB
/
test-api-simple.js
File metadata and controls
43 lines (34 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Simple API test - just health check
const http = require('http');
console.log('🧪 Testing API Server...\n');
// Test health endpoint
const options = {
hostname: 'localhost',
port: 3000,
path: '/health',
method: 'GET'
};
const req = http.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log('✅ Health Check Response:');
console.log(' Status:', res.statusCode);
console.log(' Body:', JSON.parse(data));
if (res.statusCode === 200) {
console.log('\n✅ API server is running!');
console.log('\nTo test PDF extraction, make sure the API server is running with:');
console.log(' npm run api');
console.log('\nThen in another terminal, run:');
console.log(' node test-api.js');
}
});
});
req.on('error', (error) => {
console.error('❌ Connection failed:', error.message);
console.error('\nMake sure the API server is running:');
console.error(' npm run api');
});
req.end();