fix: resolves #115

This commit is contained in:
Lakhan Samani 2022-02-05 10:09:25 +05:30
parent c09ca3b810
commit 260f533b41
2 changed files with 16 additions and 0 deletions

15
server/handlers/health.go Normal file
View File

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

View File

@ -14,6 +14,7 @@ func InitRouter() *gin.Engine {
router.Use(middlewares.CORSMiddleware()) router.Use(middlewares.CORSMiddleware())
router.GET("/", handlers.RootHandler()) router.GET("/", handlers.RootHandler())
router.GET("/health", handlers.HealthHandler())
router.POST("/graphql", handlers.GraphqlHandler()) router.POST("/graphql", handlers.GraphqlHandler())
router.GET("/playground", handlers.PlaygroundHandler()) router.GET("/playground", handlers.PlaygroundHandler())
router.GET("/oauth_login/:oauth_provider", handlers.OAuthLoginHandler()) router.GET("/oauth_login/:oauth_provider", handlers.OAuthLoginHandler())