Files
corteza/pkg/api/docs.go
T
2020-08-27 21:30:54 +02:00

19 lines
427 B
Go

package api
import (
"fmt"
"github.com/cortezaproject/corteza-server/docs"
"github.com/goware/statik/fs"
"net/http"
)
func serveDocs(w http.ResponseWriter, r *http.Request) {
root, err := fs.New(docs.Asset)
if err != nil {
http.Error(w, fmt.Sprintf("could not read embeded filesystem: %v", err.Error()), http.StatusInternalServerError)
return
}
http.StripPrefix("/docs", http.FileServer(root)).ServeHTTP(w, r)
}