package home import ( "encoding/json" "net/http" ) func Home(w http.ResponseWriter, r *http.Request) { if r.URL.Path != "/" { jsonText, _ := json.Marshal(map[string]string{"message": "Resource can not be found!!"}) w.WriteHeader(http.StatusNotFound) w.Write(jsonText) return } jsonText, _ := json.Marshal(map[string]string{"message": "Welcome to the API"}) w.Write(jsonText) } func TempResponse(w http.ResponseWriter, r *http.Request) { jsonText, _ := json.Marshal(map[string]string{"message": "Nice move by the programmer, now tell him that he forgot this part"}) w.Write(jsonText) }