init project

This commit is contained in:
2025-04-23 08:44:55 +07:00
commit 26a48770eb
43 changed files with 1639 additions and 0 deletions

35
internal/server/routes.go Normal file
View File

@@ -0,0 +1,35 @@
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("/hello", s.HelloWorldHandler)
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())
}