package main import ( "io" "net/http" ) type StringHandle3 struct { message string } func (sh *StringHandle3) ServeHTTP(writer http.ResponseWriter, request *http.Request) { Printfln("Request for %v", request.URL.Path) io.WriteString(writer, sh.message) } func main3() { http.Handle("/message", &StringHandle3{message: "Hello World!"}) http.Handle("/favicon.ico", http.NotFoundHandler()) http.Handle("/", http.RedirectHandler("/message", http.StatusTemporaryRedirect)) fsHandler := http.FileServer(http.Dir("./static")) http.Handle("/static/", http.StripPrefix("/static/", fsHandler)) err := http.ListenAndServe("localhost:5000", nil) if err != nil { Printfln("ListenAndServe Error: %v", err) return } }