Skip to content
Snippets Groups Projects
Commit d396a55e authored by Mathilde Hertaas's avatar Mathilde Hertaas
Browse files

changed the format of homehandler json respons

parent 814ac60c
No related branches found
No related tags found
No related merge requests found
...@@ -24,19 +24,23 @@ type CountryInfo struct { ...@@ -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 //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) { func homeHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
// Strukturert respons for bedre lesbarhet // Strukturert respons for bedre lesbarhet
response := map[string]interface{}{ response := map[string]interface{}{
"WELCOME": "Welcome to the Country Info API",
"endpoints": map[string]interface{}{ "endpoints": map[string]interface{}{
"Endpoint 1": map[string]string{ "Endpoint 1": map[string]string{
"Description": "Get information about a country using its ISO 3166-1 alpha-2 code.", "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}", "URL": "http://localhost:8080/countryinfo/v1/info/{country_code}{?limit=10}",
"Example": "http://localhost:8080/countryinfo/v1/info/NO", "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",
},
}, },
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment