Skip to content

Commit

Permalink
Feedback backend
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlocph committed Jan 23, 2024
1 parent 0c5af53 commit 51930b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ func yamlGenerator(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(rel.Manifest))
}

func feedback(w http.ResponseWriter, r *http.Request) {
var values map[string]interface{}
err := json.NewDecoder(r.Body).Decode(&values)
if err != nil {
logrus.Errorf("cannot decode values: %s", err)
http.Error(w, http.StatusText(400), 400)
return
}
logrus.Infof("feedback: %s", values)

w.WriteHeader(200)
w.Write([]byte("{}"))
}

func yamlGeneratorWithChart(w http.ResponseWriter, r *http.Request) {
chartFromUrlParam := chi.URLParam(r, "chart")
if chartFromUrlParam == "" {
Expand Down
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func main() {
})
r.Post("/", yamlGenerator)
r.Post("/chart/{chart}", yamlGeneratorWithChart)
r.Post("/feedback", feedback)

err = http.ListenAndServe(":9000", r)
log.Error(err)
Expand Down

0 comments on commit 51930b9

Please sign in to comment.