Dynamic File Loading
Two Modes
Section titled “Two Modes”Mode 1: Dynamic (with server.py) ⭐
Section titled “Mode 1: Dynamic (with server.py) ⭐”python3 server.pyPros: Auto-detect files, real-time updates, no code changes needed
Cons: Requires Python server running
Mode 2: Static (without server)
Section titled “Mode 2: Static (without server)”open index.htmlPros: No server needed, works offline
Cons: File list hardcoded, manual updates
Smart Fallback System
Section titled “Smart Fallback System”async loadFolder(folder) { try { // 1. Try dynamic API first const api = await fetch(`/api/files/${folder}`); if (api.ok) return await api.json(); } catch { // 2. Fallback to hardcoded list return hardcodedFiles[folder]; }}API Response Format
Section titled “API Response Format”[ { "name": "INDEX.md", "size": 1100 }, { "name": "QUICKSTART.md", "size": 4500 }]Comparison
Section titled “Comparison”| Feature | Dynamic | Static |
|---|---|---|
| Auto-detect files | ✅ | ❌ |
| No server needed | ❌ | ✅ |
| Real-time updates | ✅ | ❌ |
| Offline support | ❌ | ✅ |
| Maintenance | Low | High |
Recommendation
Section titled “Recommendation”| Use Case | Mode |
|---|---|
| Development | python3 server.py (dynamic) |
| Production | Deploy with web server |
| Demo/Offline | Static mode |