func ResultPlusOne(w http.ResponseWriter, r *http.Request) {
	var (
		err    error
		result *KeyResult
	)
	result, err = getResultFromRequest(w, r)
	if err != nil {
		JSONResponseWithStatus(w, r, nil, err, http.StatusBadRequest)
		return
	}
	if result == nil {
		JSONResponseWithStatus(w, r, nil, err, http.StatusNotFound)
		return
	}
	if result.Current == result.Target {
		JSONResponseWithStatus(w, r, result, nil, http.StatusNotModified)
		return
	}
	result.Current++
	err = SaveObjectives()
	if err != nil {
		JSONResponseWithStatus(w, r, nil, err, http.StatusBadRequest)
		return
	}
	JSONResponseWithStatus(w, r, result, nil, http.StatusOK)
}
@todo Combine ResultPlusOne and ResultMinusOne functions
package okr2go
import (
	"embed"
	"encoding/json"
	"errors"
	"io/fs"
	"net/http"
	"strconv"
	"github.com/gorilla/mux"
	"github.com/sirupsen/logrus"
)
var content embed.FS
func NewRouter() *mux.Router {
	router := mux.NewRouter().StrictSlash(true)
	router.HandleFunc("/api/objectives", GetObjectives)
	router.HandleFunc("/api/objectives/{objectiveID}/results/{resultID}/plus", ResultPlusOne)
	router.HandleFunc("/api/objectives/{objectiveID}/results/{resultID}/minus", ResultMinusOne)
	router.Methods("POST").Path("/api/objectives/{objectiveID}/results").HandlerFunc(PostKeyResult)
	fsys, _ := fs.Sub(content, "ui/build")
	router.PathPrefix("/").Handler(http.FileServer(http.FS(fsys)))
	return router
}
func PostKeyResult(w http.ResponseWriter, r *http.Request) {
	var (
		result    KeyResult
		objective *Objective
		err       error
	)
	objective, err = getObjectiveFromRequest(w, r)
	if err != nil {
		JSONResponseWithStatus(w, r, nil, err, http.StatusBadRequest)
		return
	}
	if objective == nil {
		JSONResponseWithStatus(w, r, nil, err, http.StatusNotFound)
		return
	}
	if err = json.NewDecoder(r.Body).Decode(&result); err != nil {
		JSONResponse(w, r, nil, err)
	}
	objective.KeyResults = append(objective.KeyResults, &result)
	JSONResponse(w, r, result, nil)
}
func GetObjectives(w http.ResponseWriter, r *http.Request) {
	var err error
	JSONResponse(w, r, objectives, err)
}