github.com/dearplain/goloader@v0.0.0-20190107071432-2b1e47d74273/examples/http/http.go (about)

     1  package main
     2  
     3  import "net/http"
     4  
     5  type SimpleHanle struct{}
     6  
     7  func (*SimpleHanle) ServeHTTP(w http.ResponseWriter, r *http.Request) {
     8  	w.Write([]byte("Hello goloader!"))
     9  }
    10  
    11  func main() {
    12  	go func() {
    13  		panic(http.ListenAndServe(":2300", http.FileServer(http.Dir("."))))
    14  	}()
    15  	sh := &SimpleHanle{}
    16  	mux := http.NewServeMux()
    17  	mux.Handle("/", sh)
    18  	panic(http.ListenAndServe(":9090", mux))
    19  }