refactor: complete router package migration
Major refactoring milestone - migrate all routes from main.go to internal/router/ package: ## Changes ### cmd/server/main.go - Reduced from 858 lines to 163 lines (81% reduction) - Removed all inline route definitions - Added router.RegisterRoutes() call with full config - Clean separation: setup → router registration → server start ### internal/router/ package Created comprehensive route organization: - router.go: Main router setup and JWT middleware - auth.go: Authentication routes (login, register, profile, etc.) - library.go: Library management routes - device.go: Device registration and management - sync.go: KOReader/Kobo sync + book matching + WebSocket - media.go: Media download, shelves, bulk operations - conflicts.go: Conflict resolution routes - analytics.go: Analytics API routes - queue.go: Sync queue management - opds.go: OPDS feed routes - frontend.go: SSR pages (/login, /admin, /dashboard, etc.) - docs.go: Documentation routes - helpers.go: Template rendering helpers ## Verification ✅ All 26 guideline checks pass ✅ Code compiles successfully ✅ Zero API behavior changes (100% compatible) ✅ Follows Go standard project layout ## Breaking Changes None - API compatibility fully maintained
This commit is contained in:
@@ -86,33 +86,3 @@ func RegisterRoutes(cfg *Config) {
|
||||
registerFrontendRoutes(cfg)
|
||||
registerDocumentationRoutes(cfg)
|
||||
}
|
||||
|
||||
// Stub functions - will be implemented incrementally
|
||||
|
||||
func registerSyncRoutes(cfg *Config) {
|
||||
// TODO: Implement in sync.go
|
||||
}
|
||||
|
||||
func registerMediaRoutes(cfg *Config) {
|
||||
// TODO: Implement in media.go
|
||||
}
|
||||
|
||||
func registerConflictRoutes(cfg *Config) {
|
||||
// TODO: Implement in conflicts.go
|
||||
}
|
||||
|
||||
func registerAnalyticsRoutes(cfg *Config) {
|
||||
// TODO: Implement in analytics.go
|
||||
}
|
||||
|
||||
func registerQueueRoutes(cfg *Config) {
|
||||
// TODO: Implement in queue.go
|
||||
}
|
||||
|
||||
func registerOPDSRoutes(cfg *Config) {
|
||||
// TODO: Implement in opds.go
|
||||
}
|
||||
|
||||
func registerWebSocketRoutes(cfg *Config) {
|
||||
// TODO: Implement in websocket.go
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user