This repository has been archived on 2025-08-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
web-app-template/api/utils/http-utils.go
Tim 0df0e7f6f9
Some checks failed
Build Docker Image / Explore-Gitea-Actions (push) Failing after 59s
#73 setup password hashing with argin2id and update some infra
2024-08-10 00:14:38 +02:00

12 lines
214 B
Go

package utils
import (
"encoding/json"
"net/http"
)
func WriteJSON(w http.ResponseWriter, data interface{}) error {
w.Header().Set("Content-Type", "application/json")
return json.NewEncoder(w).Encode(data)
}