commit ec5536f7ebb19ec9decc7dfa22b84628a4f964bf Author: Akansha Kardam Date: Thu Jan 29 10:52:02 2026 +0000 code update recorded at: 29/01/26 10:52:02 diff --git a/handler.go b/handler.go new file mode 100644 index 0000000..4fc45e4 --- /dev/null +++ b/handler.go @@ -0,0 +1,21 @@ +package main + +// Import necessary packages +import ( + "encoding/json" + "net/http" +) + +// Define the handler function +func handler(w http.ResponseWriter, r *http.Request) { + // Initialize a map to hold the response body + response := map[string]string{ + "message": "Hello, World!", // Set the message to "Hello, World!" + } + + // 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) +}