health-go/routers/router.go

32 lines
783 B
Go
Raw Normal View History

2024-10-17 23:52:10 +08:00
package routers
import (
"github.com/gin-gonic/gin"
"health-go/handlers"
2024-10-28 14:41:27 +08:00
"health-go/services/sms"
2024-10-17 23:52:10 +08:00
)
func SetupRouter() *gin.Engine {
2024-10-28 14:41:27 +08:00
gin.SetMode(gin.ReleaseMode)
2024-10-17 23:52:10 +08:00
r := gin.Default()
// user
r.GET("/", handlers.TestPage)
r.GET("/firstUser", handlers.FirstUser)
// record
r.GET("/fetchAllRec", handlers.FetchAllRecords)
2024-10-28 14:41:27 +08:00
r.POST("/api/insertRec", handlers.InsertRecord)
2024-10-17 23:52:10 +08:00
// hospital
2024-10-28 14:41:27 +08:00
r.GET("/fetchHosList", handlers.FetchHospitalList) // fetch all hospitals
r.POST("/api/addHos", handlers.AddHospital) // add hospital
r.POST("/api/modifyHos", handlers.ModifyHospital) // modify hospital
r.DELETE("/api/deleteHos", handlers.DeleteHospital) // delete hospital
2024-10-28 14:41:27 +08:00
// sms
r.POST("/api/sendSMS", sms.Request)
r.POST("/api/validateSMS", sms.Validate)
2024-10-17 23:52:10 +08:00
return r
}