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-09-10 12:50:37 +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
|
|
|
|
}
|