From 9f6a96ae733a9bf57a20cb3004a8e8f6f5f63b9f Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Tue, 26 Dec 2023 06:31:52 +0530 Subject: server.go & handlers: Add health check on / endpoint to show API running status --- handlers/handlers.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'handlers') diff --git a/handlers/handlers.go b/handlers/handlers.go index c15da0a..b0a0c29 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -35,6 +35,10 @@ func init() { } } +func HealthCheck(c echo.Context) error { + return c.JSON(http.StatusOK, map[string]string{"message": "API is running!"}) +} + // handleError handles errors by logging and returning a JSON response func handleError(c echo.Context, errMsg string, status int) error { log.Println(errMsg) -- cgit v1.2.3