chore: scaffold project workbench
This commit is contained in:
23
backend/internal/httpx/router.go
Normal file
23
backend/internal/httpx/router.go
Normal file
@@ -0,0 +1,23 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user