summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandomChars <random@chars.jp>2021-09-24 20:23:29 +0900
committerRandomChars <random@chars.jp>2021-09-24 20:23:29 +0900
commitdeae86a0bfc5d27e8cd564a7127925f74284cc5f (patch)
treeeb0ca1ffab3beb5956e43ba27a1cfaecd796dbbe
parent1b1147e422aaa83c33e542c58c7649ceef18b030 (diff)
redirect when no routev1.2.6
-rw-r--r--web.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/web.go b/web.go
index b51ef15..6fc7eeb 100644
--- a/web.go
+++ b/web.go
@@ -40,11 +40,9 @@ func webSetup() {
router.Use(gin.LoggerWithWriter(logger{}))
}
- // Register error page
+ // Redirect on no route
router.NoRoute(func(context *gin.Context) {
- context.JSON(http.StatusNotFound, gin.H{
- "error": "no such file or directory",
- })
+ context.Redirect(http.StatusTemporaryRedirect, "/web")
})
}