diff --git a/server.js b/server.js index 5a4229e..f4fecf8 100644 --- a/server.js +++ b/server.js @@ -49,11 +49,15 @@ async function initializeDB() { console.log(`[DB] Database initialized at: ${dbPath}`); console.log('[DB] WAL mode enabled for concurrent writes.'); + + const count = await db.get('SELECT COUNT(*) as count FROM markers'); + console.log(`[DB] Current Status: ${count.count} markers stored in database.`); } // Routes app.get('/api/markers', async (req, res) => { - console.log(`[API] GET /api/markers - Fetching markers from SQLite`); + const host = req.headers.host; + console.log(`[API] GET /api/markers - Host: ${host} - Fetching from SQLite`); try { const markers = await db.all('SELECT * FROM markers'); console.log(`[API] Found ${markers.length} markers`); diff --git a/services/api.ts b/services/api.ts index 2114534..8f00508 100644 --- a/services/api.ts +++ b/services/api.ts @@ -5,9 +5,10 @@ const API_Base_URL = '/api/markers'; export const apiService = { getHotspots: async (): Promise => { - console.log(`[API Call] GET ${API_Base_URL}`); + const fullUrl = `${window.location.origin}${API_Base_URL}`; + console.log(`[API Call] GET ${fullUrl} (Origin: ${window.location.origin})`); try { - const response = await fetch(API_Base_URL); + const response = await fetch(API_Base_URL, { cache: 'no-store' }); // 캐시 방지 추가 if (!response.ok) throw new Error('Failed to fetch markers'); const data = await response.json(); console.log(`[API Response] Received ${data.length} hotspots`, data);