package main import ( "io" "log" "net/http" ) type MyHandler int func (MyHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) { resp.Header().Set("Content-Type", "text/plain") io.WriteString(resp, req.URL.Path) } func main() { var myHandler = new(MyHandler) s := &http.Server{ Addr: ":9000", Handler: myHandler, } log.Fatal(s.ListenAndServe()) }