From 1f9d3847e04f82c231aaeb99bde371b692361164 Mon Sep 17 00:00:00 2001 From: GnomeZworc Date: Mon, 1 Apr 2024 19:49:02 +0200 Subject: [PATCH 1/2] v1.2.0: lib: add health path Signed-off-by: GnomeZworc --- lib/health/status.go | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/health/status.go diff --git a/lib/health/status.go b/lib/health/status.go new file mode 100644 index 0000000..0d9ea5e --- /dev/null +++ b/lib/health/status.go @@ -0,0 +1,11 @@ +package health + +import ( + "net/http" + + "github.com/labstack/echo/v4" +) + +func Health(c echo.Context) error { + return c.NoContent(http.StatusOK) +} From d31f7d4e0a099601ea23fdba8ea926bad7be65d6 Mon Sep 17 00:00:00 2001 From: GnomeZworc Date: Mon, 1 Apr 2024 19:49:33 +0200 Subject: [PATCH 2/2] v1.2.0: back: use health lib path Signed-off-by: GnomeZworc --- cmd/main.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 55d3d49..6bf258d 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -40,10 +40,6 @@ func isLoggedIn(c echo.Context) error { return c.NoContent(http.StatusNoContent) } -func status(c echo.Context) error { - return c.NoContent(http.StatusOK) -} - func init_database() { var err error @@ -104,7 +100,7 @@ func main() { e.GET("/", isLoggedIn) e.POST("/", login) e.DELETE("/", logout) - e.GET("/health", status) + e.GET("/health", health.Health) e.GET("/swagger/*", echoSwagger.WrapHandler) // Start server