Closed w4-hanggi closed 4 years ago
I didn't get the point. Can you give more context?
func ArticleRetrieve(c *gin.Context) {
slug := c.Param("slug")
if slug == "feed" {
ArticleFeed(c)
return
}
...
}
Like this code, due to the wildcard conflict, you have to add branch in the handler.
It looks bad, isn't it?
For the branch:
In real world you will use elasticsearch? Relational database is not good at full-text index, we need reverse index?
For the frame work:
request.com/balabala?slug=feed
, why have wildcard conflict.
router.GET("/:slug", ArticleRetrieve) ...
It's param, not query.
when the param of slug is "feed" go to ArticleFeed handler.
Please check it again.
lol, I can not answer, but here are more context https://github.com/gin-gonic/gin/issues?q=Wildcard+conflicts
Is there better way handle this conflict for wildcard?