feat: get answer ID and fragment scrolling

This commit is contained in:
httpjamesm 2023-02-14 19:55:17 -05:00
parent 6bfed5a9e3
commit cc9e549aaf
No known key found for this signature in database
4 changed files with 11 additions and 1 deletions

View file

@ -55,6 +55,10 @@ func main() {
c.Redirect(302, fmt.Sprintf("/questions/%s/placeholder", c.Param("id")))
})
r.GET("/questions/:id/:title", routes.ViewQuestion)
r.GET("/questions/:id/:title/:answerId", func(c *gin.Context) {
// redirect user to the answer with the title
c.Redirect(302, fmt.Sprintf("/questions/%s/%s#%s", c.Param("id"), c.Param("title"), c.Param("answerId")))
})
r.GET("/proxy", routes.GetImage)