// backend\routes.go package main import "net/http" func (s *Server) Routes() http.Handler { mux := http.NewServeMux() mux.HandleFunc("GET /health", s.handleHealth) mux.HandleFunc("POST /auth/register", s.handleRegister) mux.HandleFunc("POST /auth/login", s.handleLogin) mux.HandleFunc("POST /auth/logout", s.handleLogout) mux.HandleFunc("GET /auth/me", s.requireAuth(s.handleMe)) mux.HandleFunc("GET /devices", s.requireAuth(s.handleListDevices)) mux.HandleFunc("POST /devices", s.requireAuth(s.handleCreateDevice)) mux.HandleFunc("PUT /devices/{id}", s.requireAuth(s.handleUpdateDevice)) mux.HandleFunc("GET /devices/{id}/history", s.requireAuth(s.handleListDeviceHistory)) return s.cors(mux) }