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.
14 lines
375 B
Go
14 lines
375 B
Go
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)
|
|
}
|