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

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...)})
}