Esempio n. 1
0
// LoveRandom return a random value from Loves
func LoveRandom(w http.ResponseWriter, rq *http.Request) {
	r := rand.New(rand.NewSource(time.Now().UnixNano()))
	ls := love.FindAll()
	l := ls[r.Intn(len(ls))]
	responseAsJSON(w, l, http.StatusOK)
}
Esempio n. 2
0
// LoveIndex controller of /loves
func LoveIndex(w http.ResponseWriter, r *http.Request) {
	responseAsJSON(w, love.FindAll(), http.StatusOK)
}