From d396a55e80a84da64b81c51dd43a0653879653be Mon Sep 17 00:00:00 2001 From: Mathilde Hertaas <maimh@stud.ntnu.no> Date: Wed, 26 Feb 2025 09:55:47 +0100 Subject: [PATCH] changed the format of homehandler json respons --- main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 4d4f5bf..e50c9e5 100644 --- a/main.go +++ b/main.go @@ -24,19 +24,23 @@ type CountryInfo struct { //Når du kjører koden blir du sendt til en hjemmeside siden forespørsel spesifikasjoner ikke er gitt enda - //info om hvordan bruke API for info path + //info om hvordan bruke API func homeHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") // Strukturert respons for bedre lesbarhet response := map[string]interface{}{ + "WELCOME": "Welcome to the Country Info API", "endpoints": map[string]interface{}{ "Endpoint 1": map[string]string{ "Description": "Get information about a country using its ISO 3166-1 alpha-2 code.", "URL": "http://localhost:8080/countryinfo/v1/info/{country_code}{?limit=10}", "Example": "http://localhost:8080/countryinfo/v1/info/NO", - "Endpoint 2" : "To ble implemented", }, - "WELCOME": "Welcome to the Country Info API", + "Endpoint 2": map[string]interface{}{ + "Description": "TO BE IMPLEMENTED", + + }, + }, } -- GitLab