Initial release

This commit is contained in:
2021-12-16 10:08:34 +01:00
commit bc3ec64b3c
17 changed files with 684 additions and 0 deletions

17
api/api.go Normal file
View File

@@ -0,0 +1,17 @@
package api
import (
"encoding/json"
"net/http"
)
type ApiError struct {
Message string `json:"message"`
OriginalError error
Code int
}
func (ae ApiError) Send(w http.ResponseWriter) error {
w.WriteHeader(ae.Code)
return json.NewEncoder(w).Encode(ae)
}