add api response helper

This commit is contained in:
Enot (ded) Skelly committed 2026-05-22 14:12:47 -07:00
1 parent e561997de6
commit ab8410b41d
1 file changed
+12
+12
View File
@@ -0,0 +1,12 @@
package handlers
import (
"encoding/json"
"net/http"
)
func respond(w http.ResponseWriter, status int, data any) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(status)
json.NewEncoder(w).Encode(data)
}