package server import ( "fmt" "net/http" "time" ) func (srv *server) ListenToRequests() { h := srv.actions mux := http.NewServeMux() server := &http.Server{ Addr: "localhost:9000", Handler: mux, ReadTimeout: time.Second * 5, WriteTimeout: time.Second * 5, } mux.HandleFunc("/ping", h.Ping) fmt.Printf("Listening on %v\n", server.Addr) server.ListenAndServe() }