github.com/infraboard/keyauth@v0.8.1/apps/storage/http/http.go (about) 1 package http 2 3 import ( 4 "github.com/infraboard/mcube/app" 5 "github.com/infraboard/mcube/http/router" 6 7 "github.com/infraboard/keyauth/apps/storage" 8 ) 9 10 var ( 11 api = &handler{} 12 ) 13 14 type handler struct { 15 service storage.Service 16 } 17 18 // Registry 注册HTTP服务路由 19 func (h *handler) Registry(router router.SubRouter) { 20 geoipRouter := router.ResourceRouter("buckets") 21 geoipRouter.BasePath("buckets") 22 geoipRouter.Permission(true) 23 geoipRouter.Handle("POST", "/:name/objects", h.UploadGEOIPDBFile) 24 } 25 26 func (h *handler) Config() error { 27 h.service = app.GetInternalApp(storage.AppName).(storage.Service) 28 return nil 29 } 30 31 func (h *handler) Name() string { 32 return storage.AppName 33 } 34 35 func init() { 36 app.RegistryHttpApp(api) 37 }