From 25318799090b3002471378875abac324dbfeb720 Mon Sep 17 00:00:00 2001 From: Roman Zipp Date: Sun, 23 Jan 2022 18:28:14 +0100 Subject: [PATCH] Add processing pipeline on image upload --- main.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 704652b..91e208b 100644 --- a/main.go +++ b/main.go @@ -103,11 +103,20 @@ func UploadHandler(w http.ResponseWriter, r *http.Request, pipes []pipelines.IPi return } + // execute pipeline + output, err := execPipe.Run("source.jpg", bucket, storageProvider) + if err != nil { + writeError(w, http.StatusInternalServerError, "error executing pipeline") + return + } + w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(struct { - Message string `json:"message"` - }{"ok"}) + Message string `json:"message"` + OutputFiles []string `json:"output_files"` + }{"ok", []string{output}}) + if err != nil { w.WriteHeader(http.StatusInternalServerError) }