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/utils/http-utils.go
Tim 9c7d7e2cb3
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 46s
#109 switch svelte to SSR with go
2024-08-24 22:08:58 +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)
}