expose private service router

This commit is contained in:
yflau 2025-01-15 11:50:01 +08:00
parent cad8aa2c1a
commit 3badb2a584

View file

@ -11,6 +11,9 @@ import (
"github.com/yaoapp/yao/share"
)
// Router export the router to meet customized need when used yao as lib
var Router *gin.Engine
// Start the yao service
func Start(cfg config.Config) (*http.Server, error) {
@ -24,6 +27,7 @@ func Start(cfg config.Config) (*http.Server, error) {
}
router := gin.New()
Router = router
router.Use(Middlewares...)
api.SetGuards(Guards)
api.SetRoutes(router, "/api", cfg.AllowFrom...)