48 lines
1.9 KiB
Markdown
48 lines
1.9 KiB
Markdown
# API Server Fix Summary
|
|
|
|
## Issues Fixed
|
|
|
|
### 1. Syntax Error in soroban-stats.js
|
|
**Problem:** Duplicate code fragment causing `SyntaxError: Unexpected token '}'`
|
|
**Location:** `/api/business-logic/contracts/soroban-stats.js` lines 67-76
|
|
**Fix:** Removed duplicate fallback code that was left over from a previous edit
|
|
|
|
### 2. Query Parameters Not Being Passed to Route Handlers
|
|
**Problem:** `Cannot read properties of undefined (reading 'from')` and similar errors
|
|
**Root Cause:** Router was not passing `req.query` to new-format handlers
|
|
**Location:** `/api/api/router.js` line 103
|
|
**Fix:** Modified handler invocation to pass `query: req.query` parameter
|
|
|
|
```javascript
|
|
// Before:
|
|
promise = handler({params, req, res})
|
|
|
|
// After:
|
|
promise = handler({params, query: req.query, req, res})
|
|
```
|
|
|
|
## Files Modified
|
|
1. `/api/business-logic/contracts/soroban-stats.js` - Removed duplicate code
|
|
2. `/api/api/router.js` - Added query parameter passing
|
|
|
|
## Test Results
|
|
✅ API server starts successfully on port 3000
|
|
✅ MongoDB connections established
|
|
✅ Query parameters now parsed correctly
|
|
✅ Transactions endpoint working: `/explorer/public/tx/recent`
|
|
✅ Network stats endpoint working: `/explorer/public/network/stats`
|
|
✅ No more 500 Internal Server Errors for query-based endpoints
|
|
|
|
## Notes
|
|
- The purple theme changes made earlier were purely frontend (UI) modifications
|
|
- These API issues were pre-existing and unrelated to the color theme changes
|
|
- The 404 errors for some asset endpoints (like XLM native) are expected behavior when data is not in MongoDB
|
|
- The 503 errors for ledger stream are expected when ledger data is stale (normal for development)
|
|
|
|
## Server Status
|
|
- API Server: ✅ Running on port 3000
|
|
- MongoDB: ✅ Connected (public, testnet, archive)
|
|
- Redis: ⚠️ Not configured (using in-memory cache)
|
|
- Elasticsearch: ⚠️ Not configured
|
|
- Data Ingestion: ⚠️ Disabled for debugging
|