19 lines
359 B
Go
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))
|
|
}
|