Sami and Claude Opus 4.6
f865790fe1
fix(routes): restore ctx access in 15 route files broken by Phase 2.1 refactor
...
The modular refactor changed function signatures to destructured deps but
left internal ctx.* references intact, causing "ctx is not defined" errors
on /api/config, /api/logo, and many other endpoints. Also implements
loadTotpConfig and saveTotpConfig which were left as stubs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-30 03:01:29 -07:00
Krystie
5da1e572a1
refactor(server): Complete Phase 2.1 - Split monolithic server.js
...
MASSIVE REFACTOR:
- Created src/app.js (17KB) - Express setup, middleware, routes
- Slimmed server.js from 1997 lines → 230 lines (88% reduction!)
- Backed up original as server-old.js for reference
NEW STRUCTURE:
src/
├── app.js (Express application factory)
├── config/ (paths, site config, constants)
├── context/ (DI container, domain modules)
└── utils/ (http, logging, responses, async-handler)
STATS:
- Old server.js: 1997 lines (monolith)
- New server.js: 230 lines (entry point only)
- Modular code: 1729 lines across 14 files in src/
- Total reduction: 88% in main file
server.js now ONLY handles:
- App creation
- License loading
- HTTP server startup
- Feature module initialization
- Graceful shutdown
All business logic moved to src/ modules. Clean, testable, maintainable.
Phase 2.1 COMPLETE ✅
2026-03-29 19:46:41 -07:00