Changes to improve swagger ui.

- Separating out index, version and api handlers into independent web
  services. Moved the index handler to /welcome, version handler to
  /version and the api handler to /api,
This commit is contained in:
nikhiljindal
2015-01-07 15:43:38 -08:00
parent 7bff03fb41
commit 7e909ed743
4 changed files with 93 additions and 50 deletions

View File

@@ -17,21 +17,11 @@ limitations under the License.
package apiserver
import (
"fmt"
"io"
"net/http"
"github.com/emicklei/go-restful"
)
// handleIndex is the root index page for Kubernetes.
func handleIndex(req *restful.Request, resp *restful.Response) {
// TODO: use restful's Request/Response methods
if req.Request.URL.Path != "/" && req.Request.URL.Path != "/index.html" {
notFound(resp.ResponseWriter, req.Request)
return
}
resp.ResponseWriter.WriteHeader(http.StatusOK)
// TODO: serve this out of a file
data := "<html><body>Welcome to Kubernetes</body></html>"
fmt.Fprint(resp.ResponseWriter, data)
func HandleIndex(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "<html><body>Welcome to Kubernetes</body></html>")
}