Matthew Stobbs
4c132c4abf
- switched to go 1.22 net/http ServeMux for routing - seems to be working really well
22 lines
558 B
Go
22 lines
558 B
Go
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")))
|
|
s.mux.Handle("GET /static/*", fs)
|
|
|
|
// Root defaults to the cluster view
|
|
s.mux.Handle("GET /", templ.Handler(layouts.Manager("ClustVirt", "libvirt made simple")))
|
|
s.mux.Handle("GET /about", templ.Handler(static.About()))
|
|
}
|