add health method

This commit is contained in:
kandrusyak
2023-08-24 22:43:18 +03:00
parent 83f64a9c0c
commit 8af072b550

View File

@@ -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))
}