From 3badb2a58466788eb2f5baceb96f5f2e89068308 Mon Sep 17 00:00:00 2001 From: yflau <5521134@qq.com> Date: Wed, 15 Jan 2025 11:50:01 +0800 Subject: [PATCH] expose private service router --- service/service.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/service.go b/service/service.go index 17a2c90f..c85c4384 100644 --- a/service/service.go +++ b/service/service.go @@ -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...)