Example #1
0
func CreateConfiguration(w http.ResponseWriter, r *http.Request){
	body, _ := ioutil.ReadAll(r.Body)

	var cfg = database.Configuration{}

	json.Unmarshal(body, &cfg)

	database.DB.Delete(&cfg)
	ok := cfg.SaveConfiguration()

	if ok{
		json.NewEncoder(w).Encode(cfg)
	}else{
		json.NewEncoder(w).Encode(models.ApiError{
			Code: "error",
			Message: "Error on execute",
		})
	}

}