From 7a3780f3e1c448570d119062b1d05ccc1cff5e02 Mon Sep 17 00:00:00 2001 From: Florian Hoss Date: Wed, 5 Jul 2023 13:50:53 +0200 Subject: [PATCH] Fix redirecting --- internal/router/router.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/internal/router/router.go b/internal/router/router.go index c96579f..2ca4409 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -45,10 +45,6 @@ func SetupRoutes(e *echo.Echo, ctrl *controller.Controller, env *env.Config) { e.Static("/css", "web/css") e.Static("/js", "web/js") - e.GET("/", func(c echo.Context) error { - return c.Render(http.StatusOK, "index.html", nil) - }) - api := e.Group("/api") { tableGroup := api.Group("/tables") @@ -94,13 +90,6 @@ func SetupRoutes(e *echo.Echo, ctrl *controller.Controller, env *env.Config) { }) } - e.GET("/robots.txt", func(ctx echo.Context) error { - return ctx.String(http.StatusOK, "User-agent: *\nDisallow: /") - }) - e.RouteNotFound("*", func(ctx echo.Context) error { - return ctx.Redirect(http.StatusTemporaryRedirect, "/") - }) - if env.SwaggerHost != "" { docs.SwaggerInfo.Title = "Café Plätschwiesle" docs.SwaggerInfo.Description = "This is the backend of Café Plätschwiesle" @@ -112,5 +101,12 @@ func SetupRoutes(e *echo.Echo, ctrl *controller.Controller, env *env.Config) { api.GET("/swagger/*", echoSwagger.WrapHandler) zap.L().Info("swagger running", zap.String("url", env.SwaggerHost+"/api/swagger/index.html")) } + + e.GET("/robots.txt", func(ctx echo.Context) error { + return ctx.String(http.StatusOK, "User-agent: *\nDisallow: /") + }) + e.RouteNotFound("*", func(c echo.Context) error { + return c.Render(http.StatusOK, "index.html", nil) + }) } }