|
|
@@ -35,7 +35,7 @@ import (
|
|
|
func main() {
|
|
|
app := baize.NewApplication(application.Config{
|
|
|
ApiConfig: application.ApiConfig{
|
|
|
- UrlPrefix: "test",
|
|
|
+ UrlPrefix: "service",
|
|
|
Port: "10100",
|
|
|
},
|
|
|
})
|
|
|
@@ -50,6 +50,9 @@ func main() {
|
|
|
fmt.Println("Global Before2")
|
|
|
c.Next()
|
|
|
fmt.Println("Global After2")
|
|
|
+ }).
|
|
|
+ AddRoute(http.MethodGet, "/route", func(c *api.Context) {
|
|
|
+ fmt.Println("By Add Route")
|
|
|
})
|
|
|
|
|
|
rootBinder := binding.NewBinder(app.ChooseRouter(api.RouterRoot, ""), app.Infrastructure())
|
|
|
@@ -61,11 +64,11 @@ func main() {
|
|
|
c.String(http.StatusOK, "pong")
|
|
|
return nil, nil
|
|
|
},
|
|
|
- }, func(c *api.Context) {
|
|
|
+ }, func(c *api.Context, i *infrastructure.Infrastructure) {
|
|
|
fmt.Println("Root Route Before1")
|
|
|
c.Next()
|
|
|
fmt.Println("Root Route After1")
|
|
|
- }, func(c *api.Context) {
|
|
|
+ }, func(c *api.Context, i *infrastructure.Infrastructure) {
|
|
|
fmt.Println("Root Route Before2")
|
|
|
c.Next()
|
|
|
fmt.Println("Root Route After2")
|
|
|
@@ -81,6 +84,9 @@ func main() {
|
|
|
fmt.Println("Global Before2")
|
|
|
c.Next()
|
|
|
fmt.Println("Global After2")
|
|
|
+ }).
|
|
|
+ AddRoute(http.MethodGet, "/route", func(c *api.Context) {
|
|
|
+ fmt.Println("By Add Route")
|
|
|
})
|
|
|
|
|
|
prefixRootBinder := binding.NewBinder(app.ChooseRouter(api.RouterPrefix, "v1"), app.Infrastructure())
|
|
|
@@ -92,11 +98,11 @@ func main() {
|
|
|
c.String(http.StatusOK, "pong")
|
|
|
return nil, nil
|
|
|
},
|
|
|
- }, func(c *api.Context) {
|
|
|
+ }, func(c *api.Context, i *infrastructure.Infrastructure) {
|
|
|
fmt.Println("Versioned Route Before1")
|
|
|
c.Next()
|
|
|
fmt.Println("Versioned Route After1")
|
|
|
- }, func(c *api.Context) {
|
|
|
+ }, func(c *api.Context, i *infrastructure.Infrastructure) {
|
|
|
fmt.Println("Versioned Route Before2")
|
|
|
c.Next()
|
|
|
fmt.Println("Versioned Route After2")
|