2024-03-24 04:05:06 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"git.staur.ca/stobbsm/clustvirt/view/layouts"
|
|
|
|
"git.staur.ca/stobbsm/clustvirt/view/static"
|
|
|
|
"github.com/a-h/templ"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Root based routes for ClustVirt
|
|
|
|
|
|
|
|
func (s *Server) baseRoutes() {
|
|
|
|
// fileserver for static content
|
|
|
|
fs := http.StripPrefix("/static", http.FileServer(http.Dir("public")))
|
2024-03-25 21:33:04 +00:00
|
|
|
s.mux.Handle("GET /static/*", fs)
|
2024-03-24 04:05:06 +00:00
|
|
|
|
|
|
|
// Root defaults to the cluster view
|
2024-03-25 21:33:04 +00:00
|
|
|
s.mux.Handle("GET /", templ.Handler(layouts.Manager("ClustVirt", "libvirt made simple")))
|
|
|
|
s.mux.Handle("GET /about", templ.Handler(static.About()))
|
2024-03-24 04:05:06 +00:00
|
|
|
}
|