12345678910111213141516171819202122232425262728293031323334353637383940 |
- package health
- import (
- "net/http"
- "github.com/gin-gonic/gin"
- "github.com/metarare/metarare_api/common"
- "gorm.io/gorm"
- )
- type HealthV1Router struct {
- group *gin.RouterGroup
- mDB *gorm.DB
- rDB *gorm.DB
- }
- func NewHealthV1Router(r common.Router, basePath string) HealthV1Router {
- h := HealthV1Router{
- group: r.Version.Group(basePath),
- mDB: r.Db.MasterDB,
- rDB: r.Db.ReadDB,
- }
- h.group.GET("health", h.healthCheck)
- return h
- }
- // healthCheck godoc
- // @Summary API to check the status of the server
- // @Schemes
- // @Description API to check the status of the server
- // @Tags health check
- // @Accept json
- // @Produce json
- // @Success 200 {string} status OK!!
- // @Router /health [get]
- func (h HealthV1Router) healthCheck(c *gin.Context) {
- c.JSON(http.StatusOK, "healthy!!")
- }
|