Python HTTP Server
Quick Start
Section titled “Quick Start”python3 server.py# 🚀 Server running at http://localhost:8000How It Works
Section titled “How It Works”1. Start Server python3 server.py
2. Click "Docs" Button Browser → GET /api/files/docs Server → Scan docs/ folder Server → Return JSON list Browser → Load each file
3. Add New File echo "# New" > docs/NEW.md Click "Docs" → NEW.md appears!API Endpoint
Section titled “API Endpoint”GET /api/files/{folder}
Section titled “GET /api/files/{folder}”curl http://localhost:8000/api/files/docsResponse:
[ { "name": "INDEX.md", "size": 1100 }, { "name": "QUICKSTART.md", "size": 4500 }]Benefits
Section titled “Benefits”Dynamic Loading
Section titled “Dynamic Loading”- ✅ Auto-detect new files
- ✅ No code updates needed
- ✅ Real-time file list
- ✅ Scalable to any number of files
Smart Fallback
Section titled “Smart Fallback”- ✅ Works with server (dynamic)
- ✅ Works without server (hardcoded)
- ✅ Automatic detection
Server Features
Section titled “Server Features”- CORS enabled for localhost
- JSON API for file listing
- Static file serving for HTML/CSS/JS
- Error handling for missing folders
- Sorted output by filename
Comparison
Section titled “Comparison”| Mode | Setup | Auto-detect | Offline |
|---|---|---|---|
| Dynamic | python3 server.py | ✅ | ❌ |
| Static | open index.html | ❌ | ✅ |
Recommendation
Section titled “Recommendation”| Use Case | Mode |
|---|---|
| Development | python3 server.py |
| Production | Deploy with web server |
| Demo/Offline | Static mode |