Skip to content

Instantly share code, notes, and snippets.

@aisk
Created November 13, 2018 07:23
Show Gist options
  • Save aisk/563625caf1c46f66e88cd598fbda5b74 to your computer and use it in GitHub Desktop.
Save aisk/563625caf1c46f66e88cd598fbda5b74 to your computer and use it in GitHub Desktop.

Revisions

  1. aisk created this gist Nov 13, 2018.
    25 changes: 25 additions & 0 deletions vox_pprof.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    package main

    import (
    "net/http"
    "net/http/pprof"

    "github.com/aisk/vox"
    )

    func main() {
    app := vox.New()

    app.Get("/", func(req *vox.Request, res *vox.Response) {
    res.Body = "Hello, World!"
    })

    mux := http.NewServeMux()
    mux.HandleFunc("/debug/pprof/", pprof.Index)
    mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
    mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
    mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
    mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
    mux.Handle("/", app)
    http.ListenAndServe(":3000", mux)
    }