diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-11-27 14:09:05 -0500 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-11-27 14:09:05 -0500 |
commit | 0f7b0118c5a8290ed4d230a8e4bfc96daafea116 (patch) | |
tree | 296f322e4bd829a83fe5e1b994b8be53ab497ecb /backend/main.go | |
parent | 496cfab1e8867d5a8ff54402b848a6a38d03b1b0 (diff) |
Add consntructor for APIResponse
Diffstat (limited to 'backend/main.go')
-rw-r--r-- | backend/main.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/backend/main.go b/backend/main.go index 96bb824..4766de2 100644 --- a/backend/main.go +++ b/backend/main.go @@ -20,6 +20,14 @@ type APIResponse struct { Data interface{} } +func MakeAPIResponse(status int, msg string, data interface{}) *APIResponse { + return &APIResponse{ + Status: APIStatus{ + Code: status, + Msg: msg, + }, + Data: data, + } } func RecipeList(w http.ResponseWriter, r *http.Request) { |