github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/api/server/router/build/build.go (about) 1 package build 2 3 import ( 4 5 "fmt" 6 7 "github.com/docker/docker/api/server/router" 8 ) 9 10 11 // buildRouter is a router to talk with the build controller 12 type buildRouter struct { 13 backend Backend 14 routes []router.Route 15 } 16 17 // NewRouter initializes a new build router 18 func NewRouter(b Backend) router.Router { 19 fmt.Println("api/server/router/build/build.go NewRouter()") 20 r := &buildRouter{ 21 backend: b, 22 } 23 r.initRoutes() 24 return r 25 } 26 27 // Routes returns the available routers to the build controller 28 func (r *buildRouter) Routes() []router.Route { 29 fmt.Println("api/server/router/build/build.go Routes()") 30 return r.routes 31 } 32 33 func (r *buildRouter) initRoutes() { 34 r.routes = []router.Route{ 35 router.Cancellable(router.NewPostRoute("/build", r.postBuild)), 36 } 37 }