1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-23 04:47:02 +00:00

Add a simple pprof middleware for newcomers

Former-commit-id: f533df7e84b7e174d4cb861ff50d81772550feb0
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-03-05 03:36:00 +02:00
parent b961bedab0
commit 7e11032042
3 changed files with 84 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
package main
import (
"gopkg.in/kataras/iris.v6"
"gopkg.in/kataras/iris.v6/adaptors/httprouter"
"gopkg.in/kataras/iris.v6/middleware/pprof"
)
func main() {
app := iris.New()
app.Adapt(iris.DevLogger())
app.Adapt(httprouter.New())
app.Get("/", func(ctx *iris.Context) {
ctx.HTML(iris.StatusOK, "<h1> Please click <a href='/debug/pprof'>here</a>")
})
app.Get("/debug/pprof/*action", pprof.New())
// ___________
// Note:
// if you prefer gorillamux adaptor, then
// the wildcard for gorilla mux (as you already know) is '{action:.*}' instead of '*action'.
app.Listen(":8080")
}