service/library/httpengine/httpengine.go

19 lines
377 B
Go
Raw Normal View History

2023-12-21 22:17:40 +08:00
package httpengine
import (
"github.com/gin-gonic/gin"
2024-03-21 20:22:10 +08:00
"service/library/logger"
2023-12-21 22:17:40 +08:00
"service/library/middleware"
)
func NewRouter() *gin.Engine {
gin.SetMode(gin.ReleaseMode)
router := gin.New()
2024-05-23 11:31:10 +08:00
router.Use(middleware.TimeoutMiddleware())
2023-12-21 22:17:40 +08:00
router.Use(middleware.LoggerMiddleware(gin.LoggerConfig{}))
2024-03-21 20:22:10 +08:00
router.Use(gin.RecoveryWithWriter(logger.Global.Out))
2023-12-21 22:17:40 +08:00
return router
}