Skip to content

Refactor: move route handling to separate package and function#2

Open
biisal wants to merge 1 commit intocodersgyan:masterfrom
biisal:master
Open

Refactor: move route handling to separate package and function#2
biisal wants to merge 1 commit intocodersgyan:masterfrom
biisal:master

Conversation

@biisal
Copy link

@biisal biisal commented Nov 15, 2025

This pull request refactors the way HTTP routes are registered and handled in the application by introducing a centralized routing module. The main logic for route registration is moved from main.go into a new routes package, improving maintainability and scalability for future route additions.

Routing Refactor:

  • Introduced a new internal/api/routes/routes.go file that encapsulates route registration logic, including a helper function for building route strings and a dedicated function for registering contact-related routes.
  • Replaced direct route handling in cmd/camp/main.go with a call to the new routes.Register function, passing the database connection and using the returned handler in the HTTP server.
  • Updated imports in cmd/camp/main.go to use the new routes package instead of the previous contact package for route registration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant