-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-frontend-integration.js
More file actions
28 lines (23 loc) · 917 Bytes
/
Copy pathtest-frontend-integration.js
File metadata and controls
28 lines (23 loc) · 917 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
const fetch = require('node-fetch');
async function testFrontendIntegration() {
try {
console.log('Testing frontend market data integration...');
// Test the frontend stock data service through the API
const response = await fetch('http://localhost:3020/api/stocks/CBA', {
method: 'GET',
headers: { 'Content-Type': 'application/json' }
});
console.log('Response status:', response.status);
if (response.status !== 200) {
console.log('Response headers:', Object.fromEntries(response.headers));
const errorText = await response.text();
console.log('Error response:', errorText);
} else {
const data = await response.json();
console.log('Success! Stock data received:', JSON.stringify(data, null, 2));
}
} catch (error) {
console.error('Frontend integration test failed:', error.message);
}
}
testFrontendIntegration();