- ✅ Backend server is running on port 5001
- ✅ Database connection is working
- ✅ API endpoints are responding correctly
- ❌ Frontend still shows "Failed to load tasks"
The issue is likely one of these:
- Frontend not running - React dev server not started
- CORS issues - Browser blocking cross-origin requests
- Network connectivity - Frontend can't reach backend
- Configuration mismatch - Wrong API URL in frontend
# Check if backend is running
netstat -ano | findstr :5001
# If not running, start it:
cd backend
node server.jsExpected Output:
✅ Database connected successfully
✅ Database tables initialized
🚀 Server running on port 5001
📊 API available at http://localhost:5001/api
# Check if frontend is running
netstat -ano | findstr :8081
# If not running, start it:
npm run devExpected Output:
VITE v5.4.10 ready in 650 ms
➜ Local: http://localhost:8081/
Open this test page in your browser:
http://localhost:8081/test-api.html
Or manually test:
# Test health endpoint
curl http://localhost:5001/api/health
# Test tasks endpoint
curl http://localhost:5001/api/tasks- Open your React app:
http://localhost:8081 - Open browser developer tools (F12)
- Go to Console tab
- Click "View Database" button
- Look for error messages
Common Errors:
Failed to fetch= Network/CORS issueCORS error= Backend CORS not configured404 Not Found= Wrong API URL
Check config.js:
const config = {
development: {
API_URL: 'http://localhost:5001/api' // ✅ Correct
}
};The backend already has CORS configured, but if issues persist:
// In backend/server.js (already configured)
app.use(cors());Test the database connection directly:
# Test health
curl http://localhost:5001/api/health
# Test tasks
curl http://localhost:5001/api/tasks
# Test finances
curl http://localhost:5001/api/finances# Terminal 1 - Backend
cd backend
node server.js
# Terminal 2 - Frontend
npm run dev# Test backend
curl http://localhost:5001/api/health
# Open frontend
# http://localhost:8081{
"status": "ok",
"message": "Server is running",
"database": {
"host": "sql12.freesqldatabase.com",
"database": "sql12791893",
"connected": true
}
}- ✅ Page loads without errors
- ✅ "View Database" button works
- ✅ Tasks and finances display correctly
- ✅ No console errors
# Test if backend is accessible
ping localhost
telnet localhost 5001- Temporarily disable firewall
- Check if antivirus is blocking connections
# Check what's using port 5001
netstat -ano | findstr :5001
# Check what's using port 8081
netstat -ano | findstr :8081- Try different browser
- Clear browser cache
- Disable browser extensions
-
Open browser console (F12)
-
Click "View Database"
-
Look for these messages:
🌐 Using API URL: http://localhost:5001/api🔗 Fetching tasks from: http://localhost:5001/api/tasks- Any error messages
-
Check Network tab in dev tools:
- Look for failed requests to
/api/tasks - Check response status codes
- Look for failed requests to
When working correctly, you should see:
- ✅ Backend running on port 5001
- ✅ Frontend running on port 8081
- ✅ Database data loading in frontend
- ✅ No console errors
- ✅ Network requests returning 200 status
If the problem persists:
- Share browser console errors
- Share network tab details
- Confirm both servers are running
- Test with the provided test page