Redirect-short-links (#50)

* feat: redirect shortened URLs

* feat: accept shortened URLs in converter

* fix: tell resty not to follow redirect

* fix: remove log
This commit is contained in:
httpjamesm 2023-08-21 02:01:56 -04:00 committed by GitHub
parent 4760681c55
commit 2ef7e05f4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 3 deletions

View file

@ -50,6 +50,8 @@ func main() {
r.GET("/", routes.GetHome)
r.POST("/", routes.PostHome)
r.GET("/a/:id", routes.RedirectShortenedOverflowURL)
r.GET("/questions/:id", func(c *gin.Context) {
// redirect user to the question with the title
c.Redirect(302, fmt.Sprintf("/questions/%s/placeholder", c.Param("id")))