diff --git a/server/handlers/health.go b/server/handlers/health.go new file mode 100644 index 0000000..2ee3142 --- /dev/null +++ b/server/handlers/health.go @@ -0,0 +1,15 @@ +package handlers + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +// HealthHandler is the handler for /health route. +// It states if server is in healthy state or not +func HealthHandler() gin.HandlerFunc { + return func(c *gin.Context) { + c.String(http.StatusOK, "OK") + } +} diff --git a/server/routes/routes.go b/server/routes/routes.go index f5b5770..d957f86 100644 --- a/server/routes/routes.go +++ b/server/routes/routes.go @@ -14,6 +14,7 @@ func InitRouter() *gin.Engine { router.Use(middlewares.CORSMiddleware()) router.GET("/", handlers.RootHandler()) + router.GET("/health", handlers.HealthHandler()) router.POST("/graphql", handlers.GraphqlHandler()) router.GET("/playground", handlers.PlaygroundHandler()) router.GET("/oauth_login/:oauth_provider", handlers.OAuthLoginHandler())