Have a struct that has a func, ServeHTTP will be called to service requests
typeHellostruct {}func (h Hello) ServeHTTP(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "<h1> Hello from Go </h1>")//print to writer object}
Usage
funcmain() {var h Hello err := http.ListenAndServe("localhost:4000", h)checkError(err)}