These are chat archives for gin-gonic/gin

13th
Dec 2017
Arthur-Lee
@arthurkiller
Dec 13 2017 05:33
anyone here?
Lispre
@Lispre
Dec 13 2017 06:33
Yes, What is your problem?
Arthur-Lee
@arthurkiller
Dec 13 2017 06:33

@arthurkiller
Hey guys, I get a problem here

I want to use the gin for /debug/pprof and /debug/vars routing. I use gin.WrapH(http.DefaultServeMux) as the handler for prefix routing rule.

But in my code, I can not reach /debug/pprof/heap. And there is less guide in document for me.

I wonder if here are some misunderstand in my code

        router.GET("/status", Status)
        rg := router.Group("/debug", gin.WrapH(http.DefaultServeMux))  // here!
        rg.GET("/pprof", gin.WrapH(http.DefaultServeMux))
        rg.GET("/vars", gin.WrapH(http.DefaultServeMux))

gin-gonic/gin#1197
So my question is: How should I do the route for a common prefix URL request with one handler

@Lispre thx for your reply
I just got confused about the same-prefix-routing and what can route group do
And wonder if I get some mistake in code
Lispre
@Lispre
Dec 13 2017 07:01
Just use "if then else", when you need to optimize it then find a better one
Arthur-Lee
@arthurkiller
Dec 13 2017 07:02
How?
Lispre
@Lispre
Dec 13 2017 07:02
pattern match with regular expressions
Arthur-Lee
@arthurkiller
Dec 13 2017 07:03
can we ues regx in gin, great
Arthur-Lee
@arthurkiller
Dec 13 2017 07:08
If I want handler match the prefix , I should use Regx right? @Lispre
Lispre
@Lispre
Dec 13 2017 08:23
It is just my option
@arthurkiller You can try it
Arthur-Lee
@arthurkiller
Dec 13 2017 08:55

ok, thx

I use /debug/*any instead

by the way , document is really poor in this repo