Files
opal/internal/httpserver/webui.go
2025-12-29 22:05:31 +10:00

19 lines
359 B
Go

package httpserver
import (
"net/http"
)
func RegisterWebui() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/" {
http.Redirect(w, r, "/web/", http.StatusPermanentRedirect)
return
}
http.NotFound(w, r)
})
fs := http.FileServer(http.Dir("web"))
http.Handle("/web/", http.StripPrefix("/web/", fs))
}