Files
api-lis/internal/server/routes.go
2025-01-17 10:55:49 +07:00

29 lines
463 B
Go

package server
import (
"net/http"
"github.com/gin-gonic/gin"
)
func (s *Server) RegisterRoutes() http.Handler {
r := gin.Default()
r.GET("/", s.HelloWorldHandler)
r.GET("/health", s.healthHandler)
return r
}
func (s *Server) HelloWorldHandler(c *gin.Context) {
resp := make(map[string]string)
resp["message"] = "Hello World"
c.JSON(http.StatusOK, resp)
}
func (s *Server) healthHandler(c *gin.Context) {
c.JSON(http.StatusOK, s.db.Health())
}