pprof middleware for Negroni
A simple middleware for handling pprof. This handles "/debug/pprof" paths
Note: this implementation is sub-optimal, but works.
import (
"github.com/codegangsta/negroni"
"github.com/mistifyio/negroni-pprof"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "Welcome to the home page!")
}
n := negroni.Classic()
n.Use(pprof.Pprof())
n.UseHandler(mux)
n.Run(":3000")
}