Skip to content

Python HTTP Server

8000/api/files/content
python3 server.py
# 🚀 Server running at http://localhost:8000
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!
Terminal window
curl http://localhost:8000/api/files/docs

Response:

[
{ "name": "INDEX.md", "size": 1100 },
{ "name": "QUICKSTART.md", "size": 4500 }
]
  • ✅ Auto-detect new files
  • ✅ No code updates needed
  • ✅ Real-time file list
  • ✅ Scalable to any number of files
  • ✅ Works with server (dynamic)
  • ✅ Works without server (hardcoded)
  • ✅ Automatic detection
  • 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
ModeSetupAuto-detectOffline
Dynamicpython3 server.py
Staticopen index.html
Use CaseMode
Developmentpython3 server.py
ProductionDeploy with web server
Demo/OfflineStatic mode