35 lines
632 B
Go
35 lines
632 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
mikrobiologiHandler "api-lis/pkg/handlers/mikrobiologi"
|
|
)
|
|
|
|
func (s *Server) RegisterRoutes() http.Handler {
|
|
r := gin.Default()
|
|
|
|
r.GET("/health", s.healthHandler)
|
|
|
|
v1 := r.Group("/api")
|
|
|
|
mikrobiologi := v1.Group("/mikrobiologi")
|
|
{
|
|
mikrobiologi.POST("/sendmikro", mikrobiologiHandler.SendDataLISMikro)
|
|
}
|
|
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())
|
|
}
|