-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-backend.js
More file actions
37 lines (30 loc) · 1.05 KB
/
Copy pathtest-backend.js
File metadata and controls
37 lines (30 loc) · 1.05 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
// Simple test script to verify backend API
import fetch from 'node-fetch';
async function testBackend() {
try {
console.log('Testing backend at http://localhost:8787');
// Test basic endpoint
const basicResponse = await fetch('http://localhost:8787/');
const basicData = await basicResponse.json();
console.log('✅ Basic endpoint:', basicData);
// Test incident reporting
const incidentData = {
title: "Test Frontend Integration",
severity: "info",
description: "Testing the new frontend API integration",
logs: "Frontend connection test logs"
};
const incidentResponse = await fetch('http://localhost:8787/incident', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(incidentData)
});
const incidentResult = await incidentResponse.json();
console.log('📋 Incident report result:', incidentResult);
} catch (error) {
console.error('❌ Error testing backend:', error.message);
}
}
testBackend();