Refactor API routes to group server-related endpoints under a single route

This commit is contained in:
2025-07-17 21:56:58 +02:00
parent 6f571dd91c
commit bc34408f83

View File

@@ -18,13 +18,22 @@ func SetupRouter(handler *Handler) *chi.Mux {
// Define routes // Define routes
r.Route("/api/v1", func(r chi.Router) { r.Route("/api/v1", func(r chi.Router) {
r.Get("/server/help", handler.HelpHandler()) r.Route("/server", func(r chi.Router) {
r.Get("/server/version", handler.VersionHandler()) r.Get("/help", handler.HelpHandler())
r.Get("/server/devices", handler.ListDevicesHandler()) r.Get("/version", handler.VersionHandler())
r.Get("/devices", handler.ListDevicesHandler())
})
// Launch and stop handlers // Instance management endpoints
// r.Post("/server/launch/{model}", launchHandler) // r.Get("/instances", handler.ListInstances()) // List all instances
// r.Post("/server/stop/{model}", stopHandler) // r.Post("/instances", handler.CreateInstance()) // Create and start new instance
// r.Get("/instances/{id}", handler.GetInstance()) // Get instance details
// r.Put("/instances/{id}", handler.UpdateInstance()) // Update instance configuration
// r.Delete("/instances/{id}", handler.DeleteInstance()) // Stop and remove instance
// r.Post("/instances/{id}/start", handler.StartInstance()) // Start stopped instance
// r.Post("/instances/{id}/stop", handler.StopInstance()) // Stop running instance
// r.Post("/instances/{id}/restart", handler.RestartInstance()) // Restart instance
// r.Get("/instances/{id}/logs", handler.GetInstanceLogs()) // Get instance logs
}) })
return r return r