20 lines
353 B
Go
20 lines
353 B
Go
|
package main
|
||
|
|
||
|
import "net/http"
|
||
|
|
||
|
type v1Handler struct {
|
||
|
healthCheck *healthCheckHandler
|
||
|
}
|
||
|
|
||
|
func (h *v1Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||
|
var head string
|
||
|
head, r.URL.Path = shiftPath(r.URL.Path)
|
||
|
|
||
|
switch head {
|
||
|
case "health":
|
||
|
h.healthCheck.ServeHTTP(w, r)
|
||
|
default:
|
||
|
http.Error(w, "Not Found", http.StatusNotFound)
|
||
|
}
|
||
|
}
|