- Add error handling for JSON encoding in all backend handlers - Add CORS support to backend server - Add proxy configuration for frontend development server - Improve error handling in frontend API calls - Build frontend to create static files for backend serving - Add comprehensive error messages and user feedback Fixes issue where frontend received malformed JSON responses from backend API.
29 lines
699 B
Bash
Executable File
29 lines
699 B
Bash
Executable File
#!/nix/store/ypgcdmzzlgnrmdcsq72c3dxz651jg9zc-bash-5.3p3/bin/bash
|
|
|
|
# Start the server in the background
|
|
./markdown-editor --data-dir ./test/data --port 8081 --host 127.0.0.1 &
|
|
SERVER_PID=$!
|
|
|
|
# Give the server time to start
|
|
sleep 2
|
|
|
|
# Test the /api/files endpoint
|
|
echo "Testing GET /api/files..."
|
|
response=$(curl -s http://127.0.0.1:8081/api/files)
|
|
echo "Response: $response"
|
|
echo ""
|
|
|
|
# Test if it's valid JSON
|
|
if echo "$response" | python3 -m json.tool > /dev/null 2>&1; then
|
|
echo "✓ Response is valid JSON"
|
|
else
|
|
echo "✗ Response is NOT valid JSON"
|
|
echo "Response was: $response"
|
|
fi
|
|
|
|
# Kill the server
|
|
kill $SERVER_PID 2>/dev/null
|
|
wait $SERVER_PID 2>/dev/null
|
|
|
|
echo "Test completed"
|