Files
slideshowApp/utils/http.go
2026-01-21 07:27:50 +01:00

13 lines
277 B
Go

package utils
import (
"encoding/json"
"net/http"
)
func SendJSONError(w http.ResponseWriter, message string, code int) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
json.NewEncoder(w).Encode(map[string]string{"error": message})
}