Christopher Ramey
3 years ago
4 changed files with 70 additions and 16 deletions
-
24main.go
-
19server/http.go
-
37server/server.go
-
6server/worker.go
@ -0,0 +1,19 @@ |
|||
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!") |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue