health-go/routers/router.go

32 lines
799 B
Go

package routers
import (
"github.com/gin-gonic/gin"
"health-go/handlers"
"health-go/services/sms"
)
func SetupRouter() *gin.Engine {
gin.SetMode(gin.ReleaseMode)
r := gin.Default()
// user
r.GET("/", handlers.TestPage)
r.GET("/firstUser", handlers.FirstUser)
// record
r.GET("/api/fetchAllRec", handlers.FetchAllRecords)
r.POST("/api/insertRec", handlers.InsertRecord)
// hospital
r.GET("/api/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
// sms
r.POST("/api/sendSMS", sms.Request)
r.POST("/api/validateSMS", sms.Validate)
return r
}