preorder/main.go

34 lines
569 B
Go
Raw Normal View History

2024-06-18 04:37:32 +00:00
package main
import (
"net/http"
"preorder/controllers"
"preorder/models"
"github.com/gin-gonic/gin"
)
func SetupRouter() *gin.Engine {
router := gin.Default()
router.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{"message": "pong"})
})
router = controllers.ApplyAuthorRouter(router)
router = controllers.ApplyFormatRouter(router)
router = controllers.ApplyOrderRouter(router)
return router
}
func main() {
router := SetupRouter()
models.ConnectDatabase()
s := &http.Server{
Addr: ":8123",
Handler: router,
}
s.ListenAndServe()
}