forked from syntaxbullet/aurorabot
1.2 KiB
1.2 KiB
Context & Goal
The current web/src/server.ts is a monolithic file with a very long fetch handler. This makes it difficult to read and maintain. Modularizing the logic into separate route handlers and middleware-like functions will improve code quality and scalability.
Dependencies
- None
Affected Files
web/src/server.ts: Refactor to use modular handlers.web/src/routes/api.ts: New file for API route definitions.web/src/routes/static.ts: New file for static file serving logic.web/src/routes/websocket.ts: New file for WebSocket event handling.
Technical Constraints & Strategy
- Implementation: Move different responsibilities (API, Static, WS) into separate files.
- The main
serveconfiguration should just call these modules. - Ensure the SPA fallback logic remains intact.
Definition of Done (Binary)
web/src/server.tslength reduced by at least 50%.- API routes moved to dedicated module.
- Static file serving moved to dedicated module.
- WebSocket logic moved to dedicated module.
- Dashboard still loads and functions correctly.
New Test Files
- None (Verification via manual testing of the dashboard).