package server
import (
"fmt"
"net/http"
)
const index = `
Chronograf API
`
// Redoc servers the swagger JSON using the redoc package.
func Redoc(swagger string) http.HandlerFunc {
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
rw.Header().Set("Content-Type", "text/html; charset=utf-8")
rw.WriteHeader(http.StatusOK)
_, _ = rw.Write([]byte(fmt.Sprintf(index, swagger)))
return
})
}