package infra import ( "fmt" "net/http" ) // HTTPRouter crea un http.ServeMux y registra las rutas dadas. // Usa la sintaxis de Go 1.22+: "METHOD /path" como patron del mux. func HTTPRouter(routes []Route) *http.ServeMux { mux := http.NewServeMux() for _, route := range routes { pattern := fmt.Sprintf("%s %s", route.Method, route.Path) mux.Handle(pattern, route.Handler) } return mux }