Files
project_vollidioten_website/test-api-connection.js
Lars Behrends 065a6e657d feat: add world map functionality and admin map management
- Added world map page with interactive marker display
- Implemented admin map management for marker CRUD operations
- Added map layers and markers seed data to database
- Integrated new routes for map functionality
- Updated database configuration for production environment
- Added documentation page route
- Enhanced package.json with required dependencies for map features
2026-01-02 05:08:07 +01:00

64 lines
2.5 KiB
JavaScript

#!/usr/bin/env node
import fetch from 'node-fetch';
async function testAPIConnection() {
console.log('🧪 Testing API Connection...');
const baseURL = 'https://vollidioten.ceraticsoft.de';
try {
// Test basic API status
console.log('📡 Testing API status...');
const statusResponse = await fetch(`${baseURL}/api/status`);
if (statusResponse.ok) {
const statusData = await statusResponse.json();
console.log('✅ API Status:', statusData);
} else {
console.log('❌ API Status failed:', statusResponse.status);
}
// Test map metadata endpoint
console.log('🗺️ Testing map metadata endpoint...');
const metadataResponse = await fetch(`${baseURL}/api/map/metadata`);
if (metadataResponse.ok) {
const metadata = await metadataResponse.json();
console.log('✅ Map metadata:', metadata);
} else {
console.log('⚠️ Map metadata not available (this is expected if map not assembled):', metadataResponse.status);
}
// Test layers endpoint
console.log('📊 Testing layers endpoint...');
const layersResponse = await fetch(`${baseURL}/api/map/layers`);
if (layersResponse.ok) {
const layers = await layersResponse.json();
console.log('✅ Layers:', layers.length, 'layers found');
} else {
console.log('❌ Layers endpoint failed:', layersResponse.status);
}
// Test markers endpoint
console.log('📍 Testing markers endpoint...');
const markersResponse = await fetch(`${baseURL}/api/map/markers/public`);
if (markersResponse.ok) {
const markers = await markersResponse.json();
console.log('✅ Markers:', markers.length, 'markers found');
} else {
console.log('❌ Markers endpoint failed:', markersResponse.status);
}
console.log('\n🎉 API connection test completed!');
} catch (error) {
console.error('❌ API connection test failed:', error.message);
console.log('\n💡 Troubleshooting tips:');
console.log('1. Check if the backend server is running');
console.log('2. Verify the API endpoints are accessible');
console.log('3. Check for CORS issues');
console.log('4. Ensure the database is connected');
}
}
testAPIConnection();