Prompt file imported from quasydwekat2/chripy (
.github/prompts/centralize-routing.prompt.md). Copyright stays with the author.
Refactor the current Express app so routing is centralized in a dedicated route module.
Use the existing codebase context and preserve behavior:
- Identify route registrations currently defined inline in
src/server.ts. - Create or update a route module under
src/to hold the route registrations in one place. - Move route setup into a reusable function such as
registerRoutes(app)or equivalent. - Update
src/server.tsto import and call the route module instead of defining the routes inline. - Keep middleware order and request behavior unchanged, including logging, metrics, static file serving, health, validation, admin metrics, reset, and 404 handling.
- Preserve current handler implementations unless a small adjustment is required to support the routing extraction.
- Keep the change minimal and consistent with the project style.
If the codebase already has a preferred routing pattern, follow that pattern instead of introducing a new one. After editing, verify the app still compiles and that the route wiring is correct.