I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …
:date_long | 1 min Read
Go HandlerFunc()
package main
import (
"io"
"net/http"
)
func dogs(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "This is the web about dogs!\n")
}
func cats(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "This is the web about cats!\n")
}
func main() {
http.Handle("/dogs/", http.HandlerFunc(dogs))
http.Handle("/cats", http.HandlerFunc(cats))
http.ListenAndServe(":8080", nil)
}