24 lines
380 B
Go
24 lines
380 B
Go
package httpx
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"senlinai-agent/backend/internal/config"
|
|
)
|
|
|
|
func NewRouter(cfg config.Config) *gin.Engine {
|
|
if cfg.Env == "test" {
|
|
gin.SetMode(gin.TestMode)
|
|
}
|
|
|
|
router := gin.New()
|
|
router.Use(gin.Recovery())
|
|
|
|
router.GET("/healthz", func(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{"status": "ok"})
|
|
})
|
|
|
|
return router
|
|
}
|