You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
341 B
19 lines
341 B
package server
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
switch r.URL.Path {
|
|
case "/shutdown":
|
|
fmt.Fprintf(w, "shutting down .. ")
|
|
s.shutdownc <- false
|
|
case "/restart":
|
|
fmt.Fprintf(w, "restarting .. ")
|
|
s.shutdownc <- true
|
|
default:
|
|
fmt.Fprintf(w, "Hello, world!")
|
|
}
|
|
}
|