NewRESTRouter creates a mux.Router initialized with the REST API and web UI routes. See also InitStaticRouter if you need finer control of the router initialization.
(versionMain string, mgr *cbgt.Manager, staticDir, staticETag string, mr *cbgt.MsgRing, adtSvc *audit.AuditSvc)
| 114 | // API and web UI routes. See also InitStaticRouter if you need finer |
| 115 | // control of the router initialization. |
| 116 | func NewRESTRouter(versionMain string, mgr *cbgt.Manager, |
| 117 | staticDir, staticETag string, mr *cbgt.MsgRing, |
| 118 | adtSvc *audit.AuditSvc) ( |
| 119 | *mux.Router, map[string]rest.RESTMeta, error) { |
| 120 | wrapAuthVersionHandler := func(h http.Handler) http.Handler { |
| 121 | return &AuthVersionHandler{mgr: mgr, H: h, adtSvc: adtSvc} |
| 122 | } |
| 123 | |
| 124 | var options = map[string]interface{}{ |
| 125 | "auth": wrapAuthVersionHandler, |
| 126 | "mapRESTPathStats": MapRESTPathStats, |
| 127 | } |
| 128 | |
| 129 | return rest.InitRESTRouterEx( |
| 130 | InitStaticRouter(staticDir, staticETag, mgr), |
| 131 | versionMain, mgr, staticDir, staticETag, mr, |
| 132 | myAssetDir, myAsset, options) |
| 133 | } |
| 134 | |
| 135 | // -------------------------------------------------- |
| 136 |