clustvirt/router/server/root.go

22 lines
523 B
Go
Raw Normal View History

package server
import (
"net/http"
"git.staur.ca/stobbsm/clustvirt/view"
"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")))
s.r.Get("/static/*", fs.ServeHTTP)
// Root defaults to the cluster view
s.r.Get("/", templ.Handler(view.ClusterInfo(s.c)).ServeHTTP)
s.r.Get("/about", templ.Handler(static.About()).ServeHTTP)
}