Initial add backend stuff

This commit is contained in:
2026-07-08 15:45:16 -04:00
commit a7964f9410
89 changed files with 25924 additions and 0 deletions

20
httputil/respond.go Normal file
View File

@@ -0,0 +1,20 @@
package httputil
import (
"encoding/json"
"net/http"
)
func RespondJSON(w http.ResponseWriter, statusCode int, data any) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(statusCode)
json.NewEncoder(w).Encode(data)
}
func RespondError(w http.ResponseWriter, statusCode int, message string) {
RespondJSON(w, statusCode, map[string]string{"error": message})
}
func RespondSuccess(w http.ResponseWriter) {
RespondJSON(w, http.StatusOK, map[string]bool{"success": true})
}