code: func (a *API) executeCommand(f func(map[string]interface{}) interface{},
  	res http.ResponseWriter,
  	req *http.Request,
  ) {
  
  	body := make(map[string]interface{})
  	json.NewDecoder(req.Body).Decode(&body)
  
  	if f != nil {
  		a.writeJSON(map[string]interface{}{"result": f(body)}, res)
  	} else {
  		a.writeJSON(map[string]interface{}{"error": "Unknown Command"}, res)
  	}
  }
docs: // executeCommand writes JSON response with `f` returned value.