expose private service router
This commit is contained in:
parent
cad8aa2c1a
commit
3badb2a584
1 changed files with 4 additions and 0 deletions
|
|
@ -11,6 +11,9 @@ import (
|
||||||
"github.com/yaoapp/yao/share"
|
"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
|
// Start the yao service
|
||||||
func Start(cfg config.Config) (*http.Server, error) {
|
func Start(cfg config.Config) (*http.Server, error) {
|
||||||
|
|
||||||
|
|
@ -24,6 +27,7 @@ func Start(cfg config.Config) (*http.Server, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
router := gin.New()
|
router := gin.New()
|
||||||
|
Router = router
|
||||||
router.Use(Middlewares...)
|
router.Use(Middlewares...)
|
||||||
api.SetGuards(Guards)
|
api.SetGuards(Guards)
|
||||||
api.SetRoutes(router, "/api", cfg.AllowFrom...)
|
api.SetRoutes(router, "/api", cfg.AllowFrom...)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue