init project
This commit is contained in:
@@ -9,11 +9,13 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"blueprint_fix/cmd/web"
|
||||
"github.com/a-h/templ"
|
||||
"io/fs"
|
||||
"template_blueprint/cmd/web"
|
||||
|
||||
"github.com/coder/websocket"
|
||||
|
||||
patientHandler "template_blueprint/pkg/handlers/patient"
|
||||
)
|
||||
|
||||
func (s *Server) RegisterRoutes() http.Handler {
|
||||
@@ -21,8 +23,6 @@ func (s *Server) RegisterRoutes() http.Handler {
|
||||
|
||||
r.GET("/", s.HelloWorldHandler)
|
||||
|
||||
r.GET("/health", s.healthHandler)
|
||||
|
||||
r.GET("/websocket", s.websocketHandler)
|
||||
|
||||
staticFiles, _ := fs.Sub(web.Files, "assets")
|
||||
@@ -36,6 +36,13 @@ func (s *Server) RegisterRoutes() http.Handler {
|
||||
web.HelloWebHandler(c.Writer, c.Request)
|
||||
})
|
||||
|
||||
api := r.Group("/api")
|
||||
patient := api.Group("/patient")
|
||||
{
|
||||
patient.POST("/insertpatient", patientHandler.InsertPatient)
|
||||
patient.GET("/getallpatient", patientHandler.GetAllPatient)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -46,10 +53,6 @@ func (s *Server) HelloWorldHandler(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func (s *Server) healthHandler(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, s.db.Health())
|
||||
}
|
||||
|
||||
func (s *Server) websocketHandler(c *gin.Context) {
|
||||
w := c.Writer
|
||||
r := c.Request
|
||||
|
||||
Reference in New Issue
Block a user