From e2f67996a608346ea3f3525ef2febf6ca5d2b78c Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Thu, 4 Jul 2024 13:13:23 +0530 Subject: refactor: drop http api, move to sqlc/postgresql --- api/utils.go | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 api/utils.go (limited to 'api/utils.go') diff --git a/api/utils.go b/api/utils.go deleted file mode 100644 index 0fc7d35..0000000 --- a/api/utils.go +++ /dev/null @@ -1,31 +0,0 @@ -package api - -import ( - "encoding/json" - "fmt" - "io" - "log" - "net/http" -) - -func unmarshal(r io.Reader, v any) error { - body, err := io.ReadAll(r) - if err != nil { - return err - } - - err = json.Unmarshal(body, v) - if err != nil { - return err - } - - return nil -} - -func handleError(err error, rw http.ResponseWriter, status int) { - log.Println(err) - - rw.WriteHeader(status) - json := fmt.Sprintf(`{"Error": "%v"}`, http.StatusText(status)) - rw.Write([]byte(json)) -} -- cgit v1.2.3