Initial structure

This commit is contained in:
Ian Gulliver
2024-11-26 15:04:05 -06:00
parent e0f227f7d9
commit 3eb8785440
3 changed files with 74 additions and 1 deletions

14
json.go Normal file
View File

@@ -0,0 +1,14 @@
package main
import (
"encoding/json"
"net/http"
)
func sendJSON(w http.ResponseWriter, v any) {
w.Header().Set("Content-Type", "application/json")
enc := json.NewEncoder(w)
enc.SetEscapeHTML(false)
_ = enc.Encode(v)
}