Initial commit

This commit is contained in:
Ian Gulliver
2024-12-06 22:51:31 -08:00
commit 8a442173ee
6 changed files with 223 additions and 0 deletions

15
error.go Normal file
View File

@@ -0,0 +1,15 @@
package main
import (
"fmt"
"net/http"
)
type Error struct {
Message string `json:"message"`
}
func sendError(w http.ResponseWriter, code int, msg string, args ...any) {
w.WriteHeader(code)
sendJSON(w, Error{Message: fmt.Sprintf(msg, args...)})
}