From 8af072b55053458f182f0181f89a2a0735c44c7b Mon Sep 17 00:00:00 2001 From: kandrusyak Date: Thu, 24 Aug 2023 22:43:18 +0300 Subject: [PATCH] add health method --- main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.go b/main.go index 8dcf489..eb47aad 100644 --- a/main.go +++ b/main.go @@ -15,6 +15,14 @@ type FileSuccess struct { FileName string `json:"file_name"` } +func health(c echo.Context) error { + type Resp struct { + Status string `json:"status"` + } + + return c.JSON(http.StatusOK, Resp{Status: "OK"}) +} + func upload(c echo.Context) error { file, err := c.FormFile("file") if err != nil { @@ -53,6 +61,7 @@ func main() { e.Static("/", config.Env.Server.SharePath) e.POST("/upload", upload) + e.GET("/health", health) e.Logger.Fatal(e.Start(":" + config.Env.Server.Port)) }