These are chat archives for gin-gonic/gin

5th
Jun 2015
gopher-philippines
@ambo1994
Jun 05 2015 00:32
router := r.Group("/users")
{
router.GET("/", GetUsers)
router.GET("/:id", GetUser)
}
this is actually what my code looks like which return me still to an error
panic: path segment conflicts with existing wildcard..
i'm also newbie in golang and i found gin as useful to play with. Please help me. Thank you.
Manu MA
@manucorporat
Jun 05 2015 00:59
@ambo1994
[GIN-debug] GET   /users/                   --> main.index (2 handlers)
[GIN-debug] GET   /users/:id                --> main.index (2 handlers)
[GIN-debug] Listening and serving HTTP on :8080
it works for me
can you show me all the routes?
Manu MA
@manucorporat
Jun 05 2015 01:06
I am going to sleep in 6 minutes, if you can send it to me right now I could help you, otherwise, you will have to wait ;)
gopher-philippines
@ambo1994
Jun 05 2015 01:07
blob
Manu MA
@manucorporat
Jun 05 2015 01:08
I see
/users/:id is in conflict with /users/userpic
because /users/:id also would match /users/userpic
how about this:
/users/:id/pic
it makes more sense and it will work!
    router := r.Group("/users")
    {
        router.GET("/", GetUsers)
        router.GET("/:id", GetUser)
        router.GET("/:id/pic", GetUserPic)
    }
does it makes sense?
gopher-philippines
@ambo1994
Jun 05 2015 01:13
yes it makes sense.. but my uri of user pic should like this >> users/pic?user_id=1 or users/pic?account?foobar@yahoo.com .. but anyway you can now have your sleep first. ;) Thank you