github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2015/tricks/method-http.go (about)

     1  // +build ignore
     2  
     3  package main
     4  
     5  import "net/http"
     6  
     7  func main() {}
     8  
     9  type Server struct {
    10  	// Server state.
    11  }
    12  
    13  func (s *Server) index(w http.ResponseWriter, r *http.Request)  { /* Implementation. */ }
    14  func (s *Server) edit(w http.ResponseWriter, r *http.Request)   { /* Implementation. */ }
    15  func (s *Server) delete(w http.ResponseWriter, r *http.Request) { /* Implementation. */ }
    16  
    17  func (s *Server) Register(mux *http.ServeMux) {
    18  	mux.HandleFunc("/", s.index)
    19  	mux.HandleFunc("/edit/", s.edit)
    20  	mux.HandleFunc("/delete/", s.delete)
    21  }