-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
priority: highP1 - Do soon, significant improvementP1 - Do soon, significant improvementrefactorCode refactoringCode refactoring
Description
Problem
src/handlers/resource.js is 1007 lines / 34KB - too large to maintain effectively.
Current structure:
- Lines 1-35: Live reload injection (utility)
- Lines 41-48: Path extraction (utility)
- Lines 56-106: Range header parsing (utility)
- Lines 111-400+:
handleGet()- 289 lines - Lines 479-550:
handlePut()- 71 lines - Lines 687-760:
handleDelete()- 73 lines - Lines 738-825:
handlePatch()- 87 lines
Issues:
-
handleGet()at 289 lines handles too many concerns:- Container detection
- Index.html serving
- RDF content negotiation
- Directory listing
- File streaming
- Range support
-
Utilities mixed with handlers
Proposed Solution
Split into focused modules:
handlers/
├── resource.js (re-exports, backward compat)
├── get.js (handleGet)
├── put.js (handlePut)
├── delete.js (handleDelete)
├── patch.js (handlePatch)
└── utils/
├── path.js (getRequestPaths, getEffectiveUrlPath)
├── live-reload.js (injection logic)
└── ranges.js (parseRangeHeader)
Benefits
- Smaller, focused files (~200 lines each)
- Easier to test individual handlers
- Clear separation of concerns
- Utilities reusable across handlers
Priority
P1 - High impact on maintainability
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority: highP1 - Do soon, significant improvementP1 - Do soon, significant improvementrefactorCode refactoringCode refactoring