commit 0ecbe05d8701c4868c75f44e2c15edf3e4afc8eb Author: Umme Cyclewala Date: Wed Jan 28 10:22:13 2026 +0000 code update recorded at: 28/01/26 10:22:13 diff --git a/handler.go b/handler.go new file mode 100644 index 0000000..662eb4a --- /dev/null +++ b/handler.go @@ -0,0 +1,31 @@ +package main + +import ( + "encoding/json" + "fmt" + "net/http" + "time" +) + +func handler(w http.ResponseWriter, r *http.Request) { + // Set a timeout delay in milliseconds + delay := time.Second * 1 // 1 second + + fmt.Println("Starting execution...") + + // Wait for the delay to pass + time.Sleep(delay) + + fmt.Println("Execution resumed after delay.") + + // Create the response body + response := map[string]string{ + "message": "Function executed with intentional delay.", + } + fmt.Printf("Response: %s\n", response) + // Set the Content-Type header to application/json + w.Header().Set("Content-Type", "application/json") + + // Encode the response map into JSON and write it to the response + json.NewEncoder(w).Encode(response) +}