feat: add router package structure for route organization

Create internal/router/ package to organize route registration:
- router.go: Main router setup and configuration
- auth.go: Authentication routes (login, register, profile, etc.)
- docs.go: Documentation routes
- frontend.go: Frontend SSR routes (/, /login, /admin, etc.)
- helpers.go: Helper functions for template rendering

This is the first step in refactoring 858-line main.go into
a more maintainable structure following Go best practices.

Routes themselves have NOT changed - only organization.
This commit is contained in:
2026-02-06 11:09:26 -05:00
parent 2a7338200c
commit 9bc8cd7bf3
5 changed files with 504 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
package router
import (
"bookhoard/internal/docs"
)
func registerDocumentationRoutes(cfg *Config) {
docsHandler := docs.NewHTTPHandler("docs")
cfg.Echo.GET("/docs", docsHandler.DocsHome)
cfg.Echo.GET("/docs/*", docsHandler.ShowDocumentation)
cfg.Echo.GET("/docs/api/search", docsHandler.Search)
cfg.Echo.GET("/docs/search-index.json", docsHandler.ServeSearchIndex)
}