feat(*): initial commit
build / Go-Build (push) Successful in 1m1s

This commit is contained in:
2026-06-24 00:16:21 +02:00
parent 3cf9e6f266
commit 85e4df52a5
20 changed files with 1125 additions and 3 deletions
+33
View File
@@ -0,0 +1,33 @@
package vote
import (
"encoding/json"
"net/http"
"tomatentum.net/outfit-voting-abi26/internal/database"
)
func GetVoteResultEndpoint(w http.ResponseWriter, r *http.Request) {
entries, err := database.GetVotes()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(entries)
}
func GetVoteResultSingleEndoint(w http.ResponseWriter, r *http.Request) {
id := r.PathValue("id")
entry, err := database.GetVote(id)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(entry)
}