temp ui handler
parent
a59857b549
commit
ac642d0bdf
|
|
@ -3,6 +3,7 @@ package handler
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Handler struct {
|
type Handler struct {
|
||||||
|
|
@ -20,10 +21,11 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h Handler) serveHTTP(w http.ResponseWriter, r *http.Request) error {
|
func (h Handler) serveHTTP(w http.ResponseWriter, r *http.Request) error {
|
||||||
switch r.URL.Path {
|
if strings.HasPrefix(r.URL.Path, "/v1/vpntor") {
|
||||||
case "/v1/vpntor":
|
|
||||||
return h.vpntor(r.Context(), r.Body)
|
return h.vpntor(r.Context(), r.Body)
|
||||||
default:
|
} else if strings.HasPrefix(r.URL.Path, "/experimental/ui") {
|
||||||
|
return h.ui(w, r)
|
||||||
|
} else {
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<html>
|
||||||
|
<header>
|
||||||
|
</header>
|
||||||
|
<body>
|
||||||
|
<h2>Hello World</h2>
|
||||||
|
</body>
|
||||||
|
<footer>
|
||||||
|
</footer>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (h Handler) ui(w http.ResponseWriter, r *http.Request) error {
|
||||||
|
log.Printf("ui(%s)", r.URL.String())
|
||||||
|
fs := http.FileServer(http.Dir("./src/cmd/server/handler/testdata"))
|
||||||
|
http.StripPrefix("/experimental/ui", fs).ServeHTTP(w, r)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue