yjp hai 1 ano
pai
achega
0983219830

+ 6 - 0
examples/examples/project/application/application.go

@@ -4,7 +4,9 @@ import (
 	"git.sxidc.com/go-framework/baize"
 	"git.sxidc.com/go-framework/baize/examples/examples/project/application/service"
 	"git.sxidc.com/go-framework/baize/examples/examples/project/config"
+	"git.sxidc.com/go-framework/baize/framwork/api"
 	"git.sxidc.com/go-framework/baize/framwork/application"
+	"net/http"
 )
 
 var appInstance *application.App
@@ -79,3 +81,7 @@ func Finish() error {
 
 	return nil
 }
+
+func ServerHttpForTest(w http.ResponseWriter, req *http.Request) {
+	appInstance.Api().RootRouter().(*api.RootRouter).ServerHttp(w, req)
+}

+ 5 - 0
framwork/api/router.go

@@ -2,6 +2,7 @@ package api
 
 import (
 	"github.com/gin-gonic/gin"
+	"net/http"
 )
 
 // Handler 请求处理函数
@@ -62,6 +63,10 @@ func (r *RootRouter) AddRoute(method string, relativePath string, middlewares ..
 	return r
 }
 
+func (r *RootRouter) ServerHttp(w http.ResponseWriter, req *http.Request) {
+	r.engine.ServeHTTP(w, req)
+}
+
 type PrefixRouter struct {
 	groupRouter *gin.RouterGroup
 	versioned   map[string]*PrefixRouter