forked from RevoraOrg/Revora-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-health.js
More file actions
31 lines (25 loc) · 768 Bytes
/
Copy pathtest-health.js
File metadata and controls
31 lines (25 loc) · 768 Bytes
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
const http = require('http');
// Simple test to verify health endpoints work
async function testHealthEndpoints() {
const baseUrl = 'http://localhost:4000';
const endpoints = [
'/health',
'/ready',
'/live'
];
console.log('Testing health endpoints...\n');
for (const endpoint of endpoints) {
try {
const response = await fetch(`${baseUrl}${endpoint}`);
const data = await response.json();
console.log(`${endpoint}:`);
console.log(` Status: ${response.status}`);
console.log(` Response:`, JSON.stringify(data, null, 2));
console.log('');
} catch (error) {
console.log(`${endpoint}: ERROR - ${error.message}`);
}
}
}
// Run the test
testHealthEndpoints().catch(console.error);