func (l Logs) Install(c *mux.APIContainer) { // use restful: ws.Route(ws.GET("/logs/{logpath:*}").To(fileHandler)) // See github.com/emicklei/go-restful/blob/master/examples/restful-serve-static.go ws := new(restful.WebService) ws.Path("/logs") ws.Doc("get log files") ws.Route(ws.GET("/{logpath:*}").To(logFileHandler).Param(ws.PathParameter("logpath", "path to the log").DataType("string"))) ws.Route(ws.GET("/").To(logFileListHandler)) c.Add(ws) }
// Install registers the APIServer's `/version` handler. func (v Version) Install(c *mux.APIContainer) { if v.Version == nil { return } // Set up a service to return the git code version. versionWS := new(restful.WebService) versionWS.Path("/version") versionWS.Doc("git code version from which this is built") versionWS.Route( versionWS.GET("/").To(v.handleVersion). Doc("get the code version"). Operation("getCodeVersion"). Produces(restful.MIME_JSON). Consumes(restful.MIME_JSON). Writes(version.Info{})) c.Add(versionWS) }