From b426f59be7a1cd00e1360748421e02a91e499403 Mon Sep 17 00:00:00 2001 From: Steve White Date: Fri, 11 Oct 2024 17:10:32 -0500 Subject: [PATCH] Save image working along with image upload --- config/config.yaml | 2 +- handlers.go | 2 +- scripts/tests.bash | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/config.yaml b/config/config.yaml index cc647fe..6478159 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -1,6 +1,6 @@ database_path: "data/boxes.db" test_database_path: "data/test_database.db" jwt_secret: "super_secret_key" -image_storage_dir: "./images/" +image_storage_dir: "images" listening_port: 8080 log_file: "boxes.log" \ No newline at end of file diff --git a/handlers.go b/handlers.go index 28892d2..62bbdc1 100644 --- a/handlers.go +++ b/handlers.go @@ -217,7 +217,7 @@ func UploadItemImageHandler(w http.ResponseWriter, r *http.Request) { http.Error(w, "Unable to save image path in database", http.StatusInternalServerError) return } - + fmt.Println("Image upload called") // Return the image path in the response w.WriteHeader(http.StatusOK) json.NewEncoder(w).Encode(map[string]string{"imagePath": filePath}) diff --git a/scripts/tests.bash b/scripts/tests.bash index 4489979..2e94019 100755 --- a/scripts/tests.bash +++ b/scripts/tests.bash @@ -1,7 +1,7 @@ #!/bin/bash # API base URL -API_BASE_URL="http://10.0.0.66:8080" +API_BASE_URL="http://10.0.0.16:8080" # Login credentials USERNAME="boxuser"