/negroni-pprof

pprof middleware for Negroni

Primary LanguageGoApache License 2.0Apache-2.0

negroni-pprof

GoDoc Build Status

pprof middleware for Negroni

pprof

pprof middleware for Negroni.

A simple middleware for handling pprof. This handles "/debug/pprof" paths

Note: this implementation is sub-optimal, but works.

Usage

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")
}